pub struct Buffers<T> { /* private fields */ }
Implementations§
Source§impl<T> Buffers<T>
impl<T> Buffers<T>
pub const fn from_initializer(initializer: BuffersInitializer<T>) -> Self
pub const fn new(inner: T) -> Self
pub const fn initializer(&self) -> &BuffersInitializer<T>
pub fn initializer_mut(&mut self) -> &mut BuffersInitializer<T>
pub fn into_initializer(self) -> BuffersInitializer<T>
pub fn into_inner(self) -> T
pub const fn vectors_filled(&self) -> usize
Source§impl<T, Item> Buffers<T>
impl<T, Item> Buffers<T>
pub fn all_previously_filled_vectors(&self) -> &[AssertInit<T::UninitVector>]
pub fn all_previously_filled_vectors_mut( &mut self, ) -> &[AssertInit<T::UninitVector>]
pub fn current_vector_all(&self) -> Option<&[MaybeUninit<Item>]>
Sourcepub unsafe fn current_vector_all_mut(
&mut self,
) -> Option<&mut [MaybeUninit<Item>]>
pub unsafe fn current_vector_all_mut( &mut self, ) -> Option<&mut [MaybeUninit<Item>]>
Get the entire current vector as a mutable possibly-uninitialized slice, or None if all vectors are already filled.
§Safety
The caller must not allow the returned slice to be de-initialized in safe code.
pub fn current_vector_init_uninit_parts( &self, ) -> Option<(&[Item], &[MaybeUninit<Item>])>
pub fn current_vector_init_uninit_parts_mut( &mut self, ) -> Option<(&mut [Item], &mut [MaybeUninit<Item>])>
pub fn current_vector_filled_part(&self) -> Option<&[Item]>
pub fn current_vector_filled_part_mut(&mut self) -> Option<&mut [Item]>
pub fn current_vector_unfilled_all_part(&self) -> Option<&[MaybeUninit<Item>]>
Sourcepub unsafe fn current_vector_unfilled_all_part_mut(
&mut self,
) -> Option<&mut [MaybeUninit<Item>]>
pub unsafe fn current_vector_unfilled_all_part_mut( &mut self, ) -> Option<&mut [MaybeUninit<Item>]>
Retrieve all of the unfilled part as a single possibly-uninitialized mutable reference.
§Safety
Since the returned slice could contain both the unfilled but initialized, and the unfilled and uninitialized, this allows it to overlap. Thus, the caller must not de-initialize the resulting slice in any way, in safe code.
pub fn all_next_unfilled_vectors(&self) -> &[T::UninitVector]
pub fn all_next_unfilled_vectors_mut(&mut self) -> &mut [T::UninitVector]
Sourcepub fn all_filled_vectors(&self) -> (&[AssertInit<T::UninitVector>], &[Item])
pub fn all_filled_vectors(&self) -> (&[AssertInit<T::UninitVector>], &[Item])
Return all vectors that have been fully filled, sequentially, as well as the filled part of the current vector in progress.
Sourcepub fn current_vector_parts(&self) -> Option<VectorParts<'_, Item>>
pub fn current_vector_parts(&self) -> Option<VectorParts<'_, Item>>
For the current vector, return the unfilled and initialized part, the unfilled but initialized part, and the unfilled and uninitialized part, in that order.
Note that unlike current_vector_all_mut
, the exclusive
aliasing rules that come with mutable references are not needed here. The same result as
calling this can be achieved by calling the finer-grained methods that access the
individual parts of the current vector.
Sourcepub fn current_vector_parts_mut(&mut self) -> Option<VectorPartsMut<'_, Item>>
pub fn current_vector_parts_mut(&mut self) -> Option<VectorPartsMut<'_, Item>>
For the current vector, return the unfilled and initialized part, the unfilled but initialized part, and the unfilled and uninitialized part mutably, in that order.
pub fn total_vector_count(&self) -> usize
pub fn vectors_remaining(&self) -> usize
pub fn count_remaining_items_to_fill(&self) -> usize
pub fn count_total_items_in_all_vectors(&self) -> usize
Sourcepub fn remaining_for_current_vector(&self) -> usize
pub fn remaining_for_current_vector(&self) -> usize
Get the number of items that remain before the current vector becomes fully filled.
If there is no current vector, which is the condition when all vectors have been filled, then this returns zero.
Sourcepub fn advance_current_vector(&mut self, count: usize)
pub fn advance_current_vector(&mut self, count: usize)
Advance the current vector by count
items.
§Panics
This will panic if the initialized part of the current vector is exceeded. When calling this in FFI contexts, you must call the advance functions in the initializer before calling this.