Struct brownstone::move_builder::ArrayBuilder [−][src]
pub struct ArrayBuilder<T, const N: usize> { /* fields omitted */ }
Expand description
Misuse-immune array builder
This ArrayBuilder
uses move semantics to provide an array builder that
never panics or returns errors. Each call to push
takes self
by move, and returns either the builder (if it’s not full yet)
or the fully initialized array (if it is). The builder therefore can only
exist while the array being built isn’t full yet.
Implementations
Create a new ArrayBuilder
. If N == 0
, immediately return an empty
array, rather than the builder.
Add a new initialized element to the array. If this causes the array to become fully initialzed, the array is returned; otherwise, the builder is returned.
Get the slice of the array that has already been initialized.
Trait Implementations
Auto Trait Implementations
impl<T, const N: usize> RefUnwindSafe for ArrayBuilder<T, N> where
T: RefUnwindSafe,
impl<T, const N: usize> Send for ArrayBuilder<T, N> where
T: Send,
impl<T, const N: usize> Sync for ArrayBuilder<T, N> where
T: Sync,
impl<T, const N: usize> Unpin for ArrayBuilder<T, N> where
T: Unpin,
impl<T, const N: usize> UnwindSafe for ArrayBuilder<T, N> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more