Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/fs/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl File {
/// })
/// }
/// ```
pub async fn readv_at<T: IoBufMut>(
pub async fn readv_at<T: BoundedBufMut>(
&self,
bufs: Vec<T>,
pos: u64,
Expand Down Expand Up @@ -283,7 +283,7 @@ impl File {
/// ```
///
/// [`Ok(n)`]: Ok
pub async fn writev_at<T: IoBuf>(
pub async fn writev_at<T: BoundedBuf>(
&self,
buf: Vec<T>,
pos: u64,
Expand Down Expand Up @@ -408,7 +408,7 @@ impl File {
///# fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use tokio_uring::fs::File;
/// use tokio_uring::buf::fixed::FixedBufRegistry;
/// use tokio_uring::buf::IoBuf;
/// use tokio_uring::buf::BoundedBuf;
/// use std::iter;
///
/// tokio_uring::start(async {
Expand Down Expand Up @@ -601,7 +601,7 @@ impl File {
///# fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use tokio_uring::fs::File;
/// use tokio_uring::buf::fixed::FixedBufRegistry;
/// use tokio_uring::buf::IoBuf;
/// use tokio_uring::buf::BoundedBuf;
///
/// tokio_uring::start(async {
/// let registry = FixedBufRegistry::new([b"some bytes".to_vec()]);
Expand Down
8 changes: 4 additions & 4 deletions src/io/readv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::buf::IoBufMut;
use crate::buf::BoundedBufMut;
use crate::BufResult;

use crate::io::SharedFd;
Expand All @@ -19,7 +19,7 @@ pub(crate) struct Readv<T> {
iovs: Vec<iovec>,
}

impl<T: IoBufMut> Op<Readv<T>> {
impl<T: BoundedBufMut> Op<Readv<T>> {
pub(crate) fn readv_at(
fd: &SharedFd,
mut bufs: Vec<T>,
Expand All @@ -31,7 +31,7 @@ impl<T: IoBufMut> Op<Readv<T>> {
let iovs: Vec<iovec> = bufs
.iter_mut()
.map(|b| iovec {
// Safety guaranteed by `IoBufMut`.
// Safety guaranteed by `BoundedBufMut`.
iov_base: unsafe { b.stable_mut_ptr().add(b.bytes_init()) as *mut libc::c_void },
iov_len: b.bytes_total() - b.bytes_init(),
})
Expand Down Expand Up @@ -60,7 +60,7 @@ impl<T: IoBufMut> Op<Readv<T>> {

impl<T> Completable for Readv<T>
where
T: IoBufMut,
T: BoundedBufMut,
{
type Output = BufResult<usize, Vec<T>>;

Expand Down
4 changes: 2 additions & 2 deletions src/io/sendmsg_zc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::buf::IoBuf;
use crate::buf::BoundedBuf;
use crate::io::SharedFd;
use crate::runtime::driver::op::{Completable, CqeResult, MultiCQEFuture, Op, Updateable};
use crate::runtime::CONTEXT;
Expand All @@ -21,7 +21,7 @@ pub(crate) struct SendMsgZc<T, U> {
bytes: usize,
}

impl<T: IoBuf, U: IoBuf> Op<SendMsgZc<T, U>, MultiCQEFuture> {
impl<T: BoundedBuf, U: BoundedBuf> Op<SendMsgZc<T, U>, MultiCQEFuture> {
pub(crate) fn sendmsg_zc(
fd: &SharedFd,
io_bufs: Vec<T>,
Expand Down
4 changes: 2 additions & 2 deletions src/io/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Socket {
(Ok(()), buf.into_inner())
}

pub async fn writev<T: IoBuf>(&self, buf: Vec<T>) -> crate::BufResult<usize, Vec<T>> {
pub async fn writev<T: BoundedBuf>(&self, buf: Vec<T>) -> crate::BufResult<usize, Vec<T>> {
let op = Op::writev_at(&self.fd, buf, 0).unwrap();
op.await
}
Expand All @@ -147,7 +147,7 @@ impl Socket {
op.await
}

pub(crate) async fn sendmsg_zc<T: IoBuf, U: IoBuf>(
pub(crate) async fn sendmsg_zc<T: BoundedBuf, U: BoundedBuf>(
&self,
io_slices: Vec<T>,
socket_addr: SocketAddr,
Expand Down
6 changes: 3 additions & 3 deletions src/io/writev.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::runtime::driver::op::{Completable, CqeResult, Op};
use crate::runtime::CONTEXT;
use crate::{buf::IoBuf, io::SharedFd, BufResult};
use crate::{buf::BoundedBuf, io::SharedFd, BufResult};
use libc::iovec;
use std::io;

Expand All @@ -16,7 +16,7 @@ pub(crate) struct Writev<T> {
iovs: Vec<iovec>,
}

impl<T: IoBuf> Op<Writev<T>> {
impl<T: BoundedBuf> Op<Writev<T>> {
pub(crate) fn writev_at(
fd: &SharedFd,
mut bufs: Vec<T>,
Expand Down Expand Up @@ -56,7 +56,7 @@ impl<T: IoBuf> Op<Writev<T>> {

impl<T> Completable for Writev<T>
where
T: IoBuf,
T: BoundedBuf,
{
type Output = BufResult<usize, Vec<T>>;

Expand Down
4 changes: 2 additions & 2 deletions src/net/tcp/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{

use crate::{
buf::fixed::FixedBuf,
buf::{BoundedBuf, BoundedBufMut, IoBuf},
buf::{BoundedBuf, BoundedBufMut},
io::{SharedFd, Socket},
};

Expand Down Expand Up @@ -221,7 +221,7 @@ impl TcpStream {
/// written to this writer.
///
/// [`Ok(n)`]: Ok
pub async fn writev<T: IoBuf>(&self, buf: Vec<T>) -> crate::BufResult<usize, Vec<T>> {
pub async fn writev<T: BoundedBuf>(&self, buf: Vec<T>) -> crate::BufResult<usize, Vec<T>> {
self.inner.writev(buf).await
}

Expand Down
4 changes: 2 additions & 2 deletions src/net/udp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
buf::fixed::FixedBuf,
buf::{BoundedBuf, BoundedBufMut, IoBuf},
buf::{BoundedBuf, BoundedBufMut},
io::{SharedFd, Socket},
};
use socket2::SockAddr;
Expand Down Expand Up @@ -243,7 +243,7 @@ impl UdpSocket {
/// > at writes over around 10 KB.
///
/// Note: Using fixed buffers [#54](https://github.com/tokio-rs/tokio-uring/pull/54), avoids the page-pinning overhead
pub async fn sendmsg_zc<T: IoBuf, U: IoBuf>(
pub async fn sendmsg_zc<T: BoundedBuf, U: BoundedBuf>(
&self,
io_slices: Vec<T>,
socket_addr: SocketAddr,
Expand Down
4 changes: 2 additions & 2 deletions src/net/unix/stream.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
buf::fixed::FixedBuf,
buf::{BoundedBuf, BoundedBufMut, IoBuf},
buf::{BoundedBuf, BoundedBufMut},
io::{SharedFd, Socket},
};
use socket2::SockAddr;
Expand Down Expand Up @@ -181,7 +181,7 @@ impl UnixStream {
/// written to this writer.
///
/// [`Ok(n)`]: Ok
pub async fn writev<T: IoBuf>(&self, buf: Vec<T>) -> crate::BufResult<usize, Vec<T>> {
pub async fn writev<T: BoundedBuf>(&self, buf: Vec<T>) -> crate::BufResult<usize, Vec<T>> {
self.inner.writev(buf).await
}

Expand Down