Skip to main content

IoBuffersMut

Struct IoBuffersMut 

Source
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>

Source

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.

Source

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.

Source

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>

Source§

fn buffer_count(&self) -> usize

Number of active byte ranges, including empty ranges.
Source§

fn buffer(&self, index: usize) -> &[u8] ⓘ

Borrow an active initialized byte range. Panics if index is out of bounds.
Source§

fn io_slices(&self) -> Option<&[IoSlice<'_>]>

Borrow prepared I/O vectors, when available. These must describe exactly the same ranges as buffer(). Backends can otherwise build vectors in their own reusable storage. Read more
Source§

impl<Buffers: IoBufSequenceMut> IoBufSequenceMut for IoBuffersMut<Buffers>

Source§

fn buffer_mut(&mut self, index: usize) -> &mut [u8] ⓘ

Borrow an active writable byte range. Panics if index is out of bounds.
Source§

fn io_slices_mut(&mut self) -> Option<&[IoSliceMut<'_>]>

Borrow prepared writable I/O vectors, when available. The shared outer slice prevents replacing vectors or changing ranges; the exclusive sequence borrow permits a backend to write through their native pointers until retirement. Read more

Auto Trait Implementations§

§

impl<Buffers> !UnwindSafe for IoBuffersMut<Buffers>

§

impl<Buffers> Freeze for IoBuffersMut<Buffers>
where BufferSequenceOwner<Buffers>: Freeze,

§

impl<Buffers> RefUnwindSafe for IoBuffersMut<Buffers>
where BufferSequenceOwner<Buffers>: RefUnwindSafe,

§

impl<Buffers> Send for IoBuffersMut<Buffers>
where BufferSequenceOwner<Buffers>: Send,

§

impl<Buffers> Sync for IoBuffersMut<Buffers>
where BufferSequenceOwner<Buffers>: Sync,

§

impl<Buffers> Unpin for IoBuffersMut<Buffers>
where BufferSequenceOwner<Buffers>: Unpin,

§

impl<Buffers> UnsafeUnpin for IoBuffersMut<Buffers>
where BufferSequenceOwner<Buffers>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.