pub struct VectoredReadFuture<'ring, 'buf> { /* private fields */ }Expand description
Future for vectored read operations.
This future handles scatter-gather reads that operate on multiple buffers simultaneously, allowing for efficient I/O when data needs to be read into multiple non-contiguous memory regions. Returns the total bytes read and ownership of all buffers when the operation completes.
§Type Parameters
'ring- Lifetime of the io_uring Ring instance'buf- Lifetime of all buffers used for the vectored read
§Returns
Returns (usize, Vec<Pin<&'buf mut [u8]>>) on success where:
usizeis the total number of bytes read across all buffersVec<Pin<&'buf mut [u8]>>are all the buffers containing read data
§Examples
ⓘ
let mut ring = Ring::new(32)?;
let file = File::open("data.bin")?;
// Create buffers for vectored read
let mut header_buf = PinnedBuffer::with_capacity(512);
let mut data_buf = PinnedBuffer::with_capacity(4096);
let buffers = vec![header_buf.as_mut_slice(), data_buf.as_mut_slice()];
let read_future = ring.read_vectored(file.as_raw_fd(), buffers)?;
let (total_bytes, _buffers) = read_future.await?;
println!("Read {} bytes total", total_bytes);Trait Implementations§
Source§impl<'ring, 'buf> Drop for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> Drop for VectoredReadFuture<'ring, 'buf>
Auto Trait Implementations§
impl<'ring, 'buf> !RefUnwindSafe for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> !UnwindSafe for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> Freeze for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> Send for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> Sync for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> Unpin for VectoredReadFuture<'ring, 'buf>
impl<'ring, 'buf> UnsafeUnpin for VectoredReadFuture<'ring, 'buf>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more