diff --git a/src/io.rs b/src/io.rs index d7b56fb..1812a23 100644 --- a/src/io.rs +++ b/src/io.rs @@ -19,17 +19,17 @@ pub struct IO { pub enum Operation<'io_op> { Uninitialized, Open { - pathname: Pin<&'io_op CStr>, + pathname: &'io_op CStr, flags: OpenFlags, }, Read { fd: Fd, - buf: Pin<&'io_op mut [u8]>, + buf: &'io_op mut [u8], offset: u64, }, Write { fd: Fd, - buf: Pin<&'io_op [u8]>, + buf: &'io_op [u8], offset: u64, }, Close { @@ -356,7 +356,7 @@ impl IO { pub async fn open<'io_op>( &self, - pathname: Pin<&'io_op CStr>, + pathname: &'io_op CStr, flags: OpenFlags, ) -> io::Result { let mut comp = Completion::<'io_op>::default(); @@ -374,7 +374,7 @@ impl IO { pub async fn read<'io_op>( &self, fd: Fd, - buf: Pin<&'io_op mut [u8]>, + buf: &'io_op mut [u8], offset: u64, ) -> io::Result { let mut comp = Completion::<'io_op>::default(); @@ -392,7 +392,7 @@ impl IO { pub async fn write<'io_op>( &self, fd: Fd, - buf: Pin<&'io_op [u8]>, + buf: &'io_op [u8], offset: u64, ) -> io::Result { let mut comp = Completion::<'io_op>::default(); @@ -640,7 +640,7 @@ mod tests { let mut buf: [u8; 4096] = [0; 4096]; let amt = io - .read(fd, Pin::new(&mut buf[..]), 0) + .read(fd, &mut buf[..], 0) .await .expect("read should succeed"); @@ -676,7 +676,7 @@ mod tests { buf[..expected.len()].copy_from_slice(expected.as_bytes()); let amt = io - .write(fd, Pin::new(&buf[..expected.len()]), 0) + .write(fd, &buf[..expected.len()], 0) .await .expect("write should succeed"); @@ -684,7 +684,7 @@ mod tests { let mut read_buf = [0; 4096]; let amt = io - .read(fd, Pin::new(&mut read_buf[..]), 0) + .read(fd, &mut read_buf[..], 0) .await .expect("read should succeed"); diff --git a/src/main.rs b/src/main.rs index 40b8c37..5e2f835 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,7 +66,7 @@ async fn async_main(io: &IO) -> Result<()> { .await?; let stdout_fd = match io .open( - pin!(c"/dev/stdout"), + c"/dev/stdout", OpenFlags::WriteOnly | OpenFlags::Append, ) .await @@ -94,11 +94,11 @@ async fn run_server(io: &IO, socket_fd: Fd, stdout_fd: Fd) -> Result<()> { .await?; let mut buf = [0u8; 5000]; loop { - let amt = io.read(socket_fd, pin!(&mut buf[..4096]), 0).await?; + let amt = io.read(socket_fd, &mut buf[..4096], 0).await?; buf[amt] = b'\n'; // Add a newline let mut recv_buf = &buf[..amt + 1]; loop { - let amt = io.write(stdout_fd, pin!(recv_buf), 0).await?; + let amt = io.write(stdout_fd, recv_buf, 0).await?; recv_buf = &recv_buf[amt..]; if recv_buf.is_empty() { break;