pub struct IoBuffersMut<Buffers> { /* private fields */ }Expand description
An owned writable scatter/gather package with I/O vectors prepared once. Like IoBuffers, it retains the complete source sequence and supports explicit advancement after retirement.
Access to the source owner is limited to into_inner(): modifying or resizing source owners while cached vectors exist could invalidate their pointers. Read and write access to active bytes goes through the sequence traits instead.
Prepared writable vectors cannot escape their exclusive package borrow:
use base_scheduler::{IoBuffersMut, IoBufSequenceMut};
let mut buffers = IoBuffersMut::new([vec![0; 4]]);
let vectors = buffers.io_slices_mut().unwrap();
let owner = buffers.into_inner();
assert_eq!(vectors[0].len(), 4);Implementations§
Source§impl<Buffers: IoBufSequenceMut> IoBuffersMut<Buffers>
impl<Buffers: IoBufSequenceMut> IoBuffersMut<Buffers>
Sourcepub fn new(buffers: Buffers) -> Self
pub fn new(buffers: Buffers) -> Self
Prepare writable vectors once and retain the original sequence. This allocates vector storage once; ordinary operations and advancement reuse it without allocation.
Panics on Windows if an individual byte range exceeds the IoSlice/IoSliceMut 4 GiB limit.
Sourcepub fn advance(&mut self, bytes: usize)
pub fn advance(&mut self, bytes: usize)
Advance active byte ranges explicitly after a completed operation, without copying payloads or rebuilding vectors. Panics without changing the package if bytes exceeds the remaining length. Advancing by zero skips leading empty vectors.
Sourcepub fn into_inner(self) -> Buffers
pub fn into_inner(self) -> Buffers
Recover all original source owners and ranges, including received bytes in consumed ranges.
Trait Implementations§
Source§impl<Buffers: IoBufSequenceMut> IoBufSequence for IoBuffersMut<Buffers>
impl<Buffers: IoBufSequenceMut> IoBufSequence for IoBuffersMut<Buffers>
Source§impl<Buffers: IoBufSequenceMut> IoBufSequenceMut for IoBuffersMut<Buffers>
impl<Buffers: IoBufSequenceMut> IoBufSequenceMut for IoBuffersMut<Buffers>
Source§fn buffer_mut(&mut self, index: usize) -> &mut [u8] ⓘ
fn buffer_mut(&mut self, index: usize) -> &mut [u8] ⓘ
index is out of bounds.