Struct uninit_tools::initializer::BuffersInitializer[][src]

pub struct BuffersInitializer<T> { /* fields omitted */ }

Implementations

impl<T> BuffersInitializer<T>[src]

pub const fn uninit(inner: T) -> Self[src]

pub fn into_raw_parts(self) -> (T, usize, usize)[src]

pub fn into_inner(self) -> T[src]

impl<T> BuffersInitializer<SingleVector<T>>[src]

impl<T, Item> BuffersInitializer<T> where
    T: InitializeVectored,
    T::UninitVector: Initialize<Item = Item>, 
[src]

pub fn current_vector_all(&self) -> Option<&[MaybeUninit<Item>]>[src]

Retrieve the current buffer immutably, provided that there is one.

pub unsafe fn current_vector_all_mut(
    &mut self
) -> Option<&mut [MaybeUninit<Item>]>
[src]

Retrieve the current buffer mutably, provided that there is one.

Safety

This is unsafe because the caller must not de-initialize the buffer.

pub fn current_vector_init_part(&self) -> Option<&[Item]>[src]

pub fn current_vector_uninit_part(&self) -> Option<&[MaybeUninit<Item>]>[src]

pub fn current_vector_init_uninit_parts(
    &self
) -> Option<(&[Item], &[MaybeUninit<Item>])>
[src]

pub fn current_vector_init_part_mut(&mut self) -> Option<&mut [Item]>[src]

pub fn current_vector_uninit_part_mut(
    &mut self
) -> Option<&mut [MaybeUninit<Item>]>
[src]

pub fn current_vector_init_uninit_parts_mut(
    &mut self
) -> Option<(&mut [Item], &mut [MaybeUninit<Item>])>
[src]

pub fn total_vector_count(&self) -> usize[src]

Get the total number of vectors, since the wrapper was constructed.

pub fn vectors_initialized(&self) -> usize[src]

Get the number of vectors that are currently filled and completely initialized.

pub fn vectors_remaining(&self) -> usize[src]

Get the number of vectors remaining, possibly including the vector that is currently initializing.

pub fn count_items_to_initialize(&self) -> usize[src]

Counts the items that must be filled before the whole buffer is initialized.

Note that this can be expensive if there are many buffers; it is O(n), where n is the number of vectors that have not yet been initialized. If all vectors are already filled, then this completes in constant time.

pub fn count_total_items_in_all_vectors(&self) -> usize[src]

pub unsafe fn items_initialized_for_vector_unchecked(
    &self,
    vector_index: usize
) -> usize
[src]

Get the number of items that have been initialized for the vector at the given index.

For vectors that has not yet been advanced to, this will zero, while vectors that are already initialized will return the full length of that vector. The currently initializing vector will return the partial length of the items within that vector that have been initialized.

Safety

The caller must ensure that vector_index is within the bounds of the slice of vectors given by the inner wrapped value.

pub fn items_initialized_for_vector(&self, vector_index: usize) -> usize[src]

pub fn items_initialized_for_current_vector(&self) -> usize[src]

pub fn all_uninit_vectors(&self) -> &[T::UninitVector]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Get the uninitialized version of all vectors wrapped by this initializer.

pub unsafe fn all_uninit_vectors_mut(&mut self) -> &mut [T::UninitVector]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Get the uninitialized version of all vectors wrapped by this initializer, mutably.

Safety

The caller must not de-initialize any values.

pub unsafe fn advance(&mut self, count: usize) -> usize[src]

Advance the initialization cursor by count items, counting the number of items that were advanced. The count input may be higher than the total number of items in the buffer, without panics or UB.

Safety

For this to be safe, then count items in the vectors ranging from the current vector, to subsequent vectors, must be initialized.

Additionally, count must never overflow isize::MAX, but it may be larger than the total number of items in the vectors (to avoid having to count them in the beginning, for performance purposes).

pub unsafe fn advance_current_vector_to_end(&mut self)[src]

Advance the initialization progress to the end of the current vector, thus wrapping and continuing to the next

Safety

This is unsafe not only because of the initialization invariant, but also because it does not check whether the initialized vectors counter is at the end (meaning that all vectors are initialized). The caller must hence ensure that the value of vectors_remaining is larger than zero.

pub unsafe fn advance_current_vector(&mut self, count: usize)[src]

pub fn partially_fill_current_vector_uninit_part(
    &mut self,
    count: usize,
    item: Item
) where
    Item: Copy
[src]

pub fn fill_current_vector_uninit_part(&mut self, item: Item) where
    Item: Copy
[src]

pub fn try_into_init(self) -> Result<AssertInitVectors<T>, Self>[src]

impl<T> BuffersInitializer<T> where
    T: InitializeVectored,
    T::UninitVector: Initialize<Item = u8>, 
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BuffersInitializer<T> where
    T: RefUnwindSafe

impl<T> Send for BuffersInitializer<T> where
    T: Send

impl<T> Sync for BuffersInitializer<T> where
    T: Sync

impl<T> Unpin for BuffersInitializer<T> where
    T: Unpin

impl<T> UnwindSafe for BuffersInitializer<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.