pub struct VecWriter { /* private fields */ }Expand description
A writer that batches multiple small writes for vectored I/O.
This reduces the number of system calls by accumulating writes and sending them as a single vectored write operation.
Implementations§
Source§impl VecWriter
impl VecWriter
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a vectored writer with the specified chunk capacity.
Sourcepub fn push_slice(&mut self, data: &[u8])
pub fn push_slice(&mut self, data: &[u8])
Add a slice to the writer (copies into a new Bytes).
Sourcepub const fn chunk_count(&self) -> usize
pub const fn chunk_count(&self) -> usize
Get the number of chunks.
Sourcepub fn as_io_slices(&self) -> Vec<IoSlice<'_>>
pub fn as_io_slices(&self) -> Vec<IoSlice<'_>>
Get the chunks as I/O slices for vectored writes.
The returned slices can be passed to write_vectored.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VecWriter
impl RefUnwindSafe for VecWriter
impl Send for VecWriter
impl Sync for VecWriter
impl Unpin for VecWriter
impl UnwindSafe for VecWriter
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