pub struct BufferRef<'buffer, T> { /* private fields */ }
Expand description
A reference to a Buffer
, which is meant be a subset of the functionality offered by the
fully owned buffer.
For example, it neither allows reading from the unfilled region, nor swapping out the buffer pointed to, with anything else.
Implementations§
Source§impl<'buffer, T> BufferRef<'buffer, T>where
T: Initialize,
impl<'buffer, T> BufferRef<'buffer, T>where
T: Initialize,
pub fn remaining(&self) -> usize
pub fn unfilled_parts( &mut self, ) -> (&mut [T::Item], &mut [MaybeUninit<T::Item>])
Sourcepub unsafe fn unfilled_mut(&mut self) -> &mut [MaybeUninit<T::Item>]
pub unsafe fn unfilled_mut(&mut self) -> &mut [MaybeUninit<T::Item>]
Get a mutable and possibly-uninitialized reference to all of the buffer.
§Safety
The caller must not allow safe code to de-initialize the resulting slice.
Sourcepub unsafe fn advance(&mut self, count: usize)
pub unsafe fn advance(&mut self, count: usize)
Advance the counter of the number of items filled.
The number of items that are initialized is also updated accordingly, so that the number of items initialized is always greater than or equal to the number of items filled.
§Safety
The caller must uphold the initialization invariant.
Sourcepub unsafe fn advance_all(&mut self)
pub unsafe fn advance_all(&mut self)
Advance the counter of the number of items filled, and the number of items initialized, to the end of the buffer.
§Safety
The caller must uphold the initialization invariant.