pub struct VectoredWriteFuture<'ring, 'buf> { /* private fields */ }Expand description
Future for vectored write operations.
This future handles gather writes that operate on multiple buffers simultaneously, allowing for efficient I/O when data from multiple non-contiguous memory regions needs to be written in a single operation. Returns the total bytes written and ownership of all buffers when complete.
§Type Parameters
'ring- Lifetime of the io_uring Ring instance'buf- Lifetime of all buffers used for the vectored write
§Returns
Returns (usize, Vec<Pin<&'buf mut [u8]>>) on success where:
usizeis the total number of bytes written from all buffersVec<Pin<&'buf mut [u8]>>are all the buffers that were written from
§Examples
ⓘ
let mut ring = Ring::new(32)?;
let file = OpenOptions::new()
.write(true)
.create(true)
.open("output.bin")?;
// Create buffers for vectored write
let mut header_buf = PinnedBuffer::from_slice(b"HEADER: ");
let mut data_buf = PinnedBuffer::from_slice(b"Important data content");
let buffers = vec![header_buf.as_mut_slice(), data_buf.as_mut_slice()];
let write_future = ring.write_vectored(file.as_raw_fd(), buffers)?;
let (total_bytes, _buffers) = write_future.await?;
println!("Wrote {} bytes total", total_bytes);Trait Implementations§
Source§impl<'ring, 'buf> Drop for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> Drop for VectoredWriteFuture<'ring, 'buf>
Auto Trait Implementations§
impl<'ring, 'buf> !RefUnwindSafe for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> !UnwindSafe for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> Freeze for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> Send for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> Sync for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> Unpin for VectoredWriteFuture<'ring, 'buf>
impl<'ring, 'buf> UnsafeUnpin for VectoredWriteFuture<'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