diff --git a/src/fs/file.rs b/src/fs/file.rs index 9cd47f21..9fc2e1a2 100644 --- a/src/fs/file.rs +++ b/src/fs/file.rs @@ -176,7 +176,7 @@ impl File { /// }) /// } /// ``` - pub async fn read_at(&self, buf: T, pos: u64) -> crate::BufResult { + pub async fn read_at(&self, buf: B, pos: u64) -> crate::BufResult { // Submit the read operation let op = Op::read_at(&self.fd, buf, pos).unwrap(); op.await @@ -227,11 +227,11 @@ impl File { /// }) /// } /// ``` - pub async fn readv_at( + pub async fn readv_at( &self, - bufs: Vec, + bufs: Vec, pos: u64, - ) -> crate::BufResult> { + ) -> crate::BufResult> { // Submit the read operation let op = Op::readv_at(&self.fd, bufs, pos).unwrap(); op.await @@ -392,13 +392,13 @@ impl File { /// ``` /// /// [`ErrorKind::UnexpectedEof`]: std::io::ErrorKind::UnexpectedEof - pub async fn read_exact_at(&self, buf: T, pos: u64) -> crate::BufResult<(), T> + pub async fn read_exact_at(&self, buf: B, pos: u64) -> crate::BufResult<(), B> where - T: BoundedBufMut, + B: BoundedBufMut, { let orig_bounds = buf.bounds(); let (res, buf) = self.read_exact_slice_at(buf.slice_full(), pos).await; - (res, T::from_buf_bounds(buf, orig_bounds)) + (res, B::from_buf_bounds(buf, orig_bounds)) } async fn read_exact_slice_at( @@ -484,9 +484,9 @@ impl File { /// }) ///# } /// ``` - pub async fn read_fixed_at(&self, buf: T, pos: u64) -> crate::BufResult + pub async fn read_fixed_at(&self, buf: B, pos: u64) -> crate::BufResult where - T: BoundedBufMut, + B: BoundedBufMut, { // Submit the read operation let op = Op::read_fixed_at(&self.fd, buf, pos).unwrap(); diff --git a/src/io/read.rs b/src/io/read.rs index c3395b40..0dbf215c 100644 --- a/src/io/read.rs +++ b/src/io/read.rs @@ -16,8 +16,8 @@ pub(crate) struct Read { pub(crate) buf: T, } -impl Op> { - pub(crate) fn read_at(fd: &SharedFd, buf: T, offset: u64) -> io::Result>> { +impl Op> { + pub(crate) fn read_at(fd: &SharedFd, buf: B, offset: u64) -> io::Result>> { use io_uring::{opcode, types}; CONTEXT.with(|x| { @@ -39,11 +39,11 @@ impl Op> { } } -impl Completable for Read +impl Completable for Read where - T: BoundedBufMut, + B: BoundedBufMut, { - type Output = BufResult; + type Output = BufResult; fn complete(self, cqe: CqeResult) -> Self::Output { // Convert the operation result to `usize` diff --git a/src/io/read_fixed.rs b/src/io/read_fixed.rs index 3cb96cdb..8e49bb06 100644 --- a/src/io/read_fixed.rs +++ b/src/io/read_fixed.rs @@ -17,15 +17,15 @@ pub(crate) struct ReadFixed { buf: T, } -impl Op> +impl Op> where - T: BoundedBufMut, + B: BoundedBufMut, { pub(crate) fn read_fixed_at( fd: &SharedFd, - buf: T, + buf: B, offset: u64, - ) -> io::Result>> { + ) -> io::Result>> { use io_uring::{opcode, types}; CONTEXT.with(|x| { @@ -48,11 +48,11 @@ where } } -impl Completable for ReadFixed +impl Completable for ReadFixed where - T: BoundedBufMut, + B: BoundedBufMut, { - type Output = BufResult; + type Output = BufResult; fn complete(self, cqe: op::CqeResult) -> Self::Output { // Convert the operation result to `usize` diff --git a/src/io/readv.rs b/src/io/readv.rs index ff71dc79..1e1b3359 100644 --- a/src/io/readv.rs +++ b/src/io/readv.rs @@ -19,12 +19,12 @@ pub(crate) struct Readv { iovs: Vec, } -impl Op> { +impl Op> { pub(crate) fn readv_at( fd: &SharedFd, - mut bufs: Vec, + mut bufs: Vec, offset: u64, - ) -> io::Result>> { + ) -> io::Result>> { use io_uring::{opcode, types}; // Build `iovec` objects referring the provided `bufs` for `io_uring::opcode::Readv`. @@ -58,11 +58,11 @@ impl Op> { } } -impl Completable for Readv +impl Completable for Readv where - T: BoundedBufMut, + B: BoundedBufMut, { - type Output = BufResult>; + type Output = BufResult>; fn complete(self, cqe: CqeResult) -> Self::Output { // Convert the operation result to `usize` diff --git a/src/io/recv_from.rs b/src/io/recv_from.rs index e9b360ca..ba9ee6fd 100644 --- a/src/io/recv_from.rs +++ b/src/io/recv_from.rs @@ -16,8 +16,8 @@ pub(crate) struct RecvFrom { pub(crate) msghdr: Box, } -impl Op> { - pub(crate) fn recv_from(fd: &SharedFd, mut buf: T) -> io::Result>> { +impl Op> { + pub(crate) fn recv_from(fd: &SharedFd, mut buf: B) -> io::Result>> { use io_uring::{opcode, types}; let mut io_slices = vec![IoSliceMut::new(unsafe { @@ -53,11 +53,11 @@ impl Op> { } } -impl Completable for RecvFrom +impl Completable for RecvFrom where - T: BoundedBufMut, + B: BoundedBufMut, { - type Output = BufResult<(usize, SocketAddr), T>; + type Output = BufResult<(usize, SocketAddr), B>; fn complete(self, cqe: CqeResult) -> Self::Output { // Convert the operation result to `usize` diff --git a/src/io/recvmsg.rs b/src/io/recvmsg.rs index 3cae2e50..87d8650e 100644 --- a/src/io/recvmsg.rs +++ b/src/io/recvmsg.rs @@ -17,8 +17,8 @@ pub(crate) struct RecvMsg { pub(crate) msghdr: Box, } -impl Op> { - pub(crate) fn recvmsg(fd: &SharedFd, mut bufs: Vec) -> io::Result>> { +impl Op> { + pub(crate) fn recvmsg(fd: &SharedFd, mut bufs: Vec) -> io::Result>> { use io_uring::{opcode, types}; let mut io_slices = Vec::with_capacity(bufs.len()); @@ -57,11 +57,11 @@ impl Op> { } } -impl Completable for RecvMsg +impl Completable for RecvMsg where - T: BoundedBufMut, + B: BoundedBufMut, { - type Output = BufResult<(usize, SocketAddr), Vec>; + type Output = BufResult<(usize, SocketAddr), Vec>; fn complete(self, cqe: CqeResult) -> Self::Output { // Convert the operation result to `usize` diff --git a/src/io/socket.rs b/src/io/socket.rs index dda1bb36..4c8b2e6b 100644 --- a/src/io/socket.rs +++ b/src/io/socket.rs @@ -168,31 +168,31 @@ impl Socket { op.await } - pub(crate) async fn read(&self, buf: T) -> crate::BufResult { + pub(crate) async fn read(&self, buf: B) -> crate::BufResult { let op = Op::read_at(&self.fd, buf, 0).unwrap(); op.await } - pub(crate) async fn read_fixed(&self, buf: T) -> crate::BufResult + pub(crate) async fn read_fixed(&self, buf: B) -> crate::BufResult where - T: BoundedBufMut, + B: BoundedBufMut, { let op = Op::read_fixed_at(&self.fd, buf, 0).unwrap(); op.await } - pub(crate) async fn recv_from( + pub(crate) async fn recv_from( &self, - buf: T, - ) -> crate::BufResult<(usize, SocketAddr), T> { + buf: B, + ) -> crate::BufResult<(usize, SocketAddr), B> { let op = Op::recv_from(&self.fd, buf).unwrap(); op.await } - pub(crate) async fn recvmsg( + pub(crate) async fn recvmsg( &self, - buf: Vec, - ) -> crate::BufResult<(usize, SocketAddr), Vec> { + buf: Vec, + ) -> crate::BufResult<(usize, SocketAddr), Vec> { let op = Op::recvmsg(&self.fd, buf).unwrap(); op.await } diff --git a/src/net/tcp/stream.rs b/src/net/tcp/stream.rs index 2450dcb9..86051f00 100644 --- a/src/net/tcp/stream.rs +++ b/src/net/tcp/stream.rs @@ -74,7 +74,7 @@ impl TcpStream { /// Read some data from the stream into the buffer. /// /// Returns the original buffer and quantity of data read. - pub async fn read(&self, buf: T) -> crate::BufResult { + pub async fn read(&self, buf: B) -> crate::BufResult { self.inner.read(buf).await } @@ -91,9 +91,9 @@ impl TcpStream { /// In addition to errors that can be reported by `read`, /// this operation fails if the buffer is not registered in the /// current `tokio-uring` runtime. - pub async fn read_fixed(&self, buf: T) -> crate::BufResult + pub async fn read_fixed(&self, buf: B) -> crate::BufResult where - T: BoundedBufMut, + B: BoundedBufMut, { self.inner.read_fixed(buf).await } diff --git a/src/net/udp.rs b/src/net/udp.rs index cb0cef66..7f1fd1b3 100644 --- a/src/net/udp.rs +++ b/src/net/udp.rs @@ -296,27 +296,27 @@ impl UdpSocket { /// Receives a single datagram message on the socket. /// /// On success, returns the number of bytes read and the origin. - pub async fn recv_from( + pub async fn recv_from( &self, - buf: T, - ) -> crate::BufResult<(usize, SocketAddr), T> { + buf: B, + ) -> crate::BufResult<(usize, SocketAddr), B> { self.inner.recv_from(buf).await } /// Receives a single datagram message on the socket, into multiple buffers /// /// On success, returns the number of bytes read and the origin. - pub async fn recvmsg( + pub async fn recvmsg( &self, - buf: Vec, - ) -> crate::BufResult<(usize, SocketAddr), Vec> { + buf: Vec, + ) -> crate::BufResult<(usize, SocketAddr), Vec> { self.inner.recvmsg(buf).await } /// Reads a packet of data from the socket into the buffer. /// /// Returns the original buffer and quantity of data read. - pub async fn read(&self, buf: T) -> crate::BufResult { + pub async fn read(&self, buf: B) -> crate::BufResult { self.inner.read(buf).await } @@ -333,9 +333,9 @@ impl UdpSocket { /// In addition to errors that can be reported by `read`, /// this operation fails if the buffer is not registered in the /// current `tokio-uring` runtime. - pub async fn read_fixed(&self, buf: T) -> crate::BufResult + pub async fn read_fixed(&self, buf: B) -> crate::BufResult where - T: BoundedBufMut, + B: BoundedBufMut, { self.inner.read_fixed(buf).await } diff --git a/src/net/unix/stream.rs b/src/net/unix/stream.rs index 40e7ddc5..f3c304cf 100644 --- a/src/net/unix/stream.rs +++ b/src/net/unix/stream.rs @@ -75,7 +75,7 @@ impl UnixStream { /// Read some data from the stream into the buffer, returning the original buffer and /// quantity of data read. - pub async fn read(&self, buf: T) -> crate::BufResult { + pub async fn read(&self, buf: B) -> crate::BufResult { self.inner.read(buf).await } @@ -90,9 +90,9 @@ impl UnixStream { /// In addition to errors that can be reported by `read`, /// this operation fails if the buffer is not registered in the /// current `tokio-uring` runtime. - pub async fn read_fixed(&self, buf: T) -> crate::BufResult + pub async fn read_fixed(&self, buf: B) -> crate::BufResult where - T: BoundedBufMut, + B: BoundedBufMut, { self.inner.read_fixed(buf).await }