Struct brownstone::builder::ArrayBuilder [−][src]
pub struct ArrayBuilder<T, const N: usize> { /* fields omitted */ }
Expand description
Low-level builder type for [T; N]
arrays. Uses a push
+ finish
interface to build an array 1 element
at a time.
The interface provided by this type is fairly low level; most of its
methods are fallible in some way (returning a Result
or panicking on
errors). Consider instead the misuse-resistant
move_builder::ArrayBuilder
, which
uses ownership semantics to provide only infallible operations, or the
builder functions at the top-level of the crate.
Implementations
Returns true if every element in the array is initialized. If the
builder is full, the next call to finish
will return the built array.
Add an initialized element to the array, without performing a bounds check.
Safety
This must only be called when the builder is not full
Try to add an initialized element to the array. Returns an error if the array is already full.
Return the fully initialized array without checking that it’s fully initialized.
Safety
This must only be called when the builder is full.
Try to return the fully initialized array. Returns the builder if the array isn’t fully initialized yet.
Get the slice of the array that has already been initialized.
Trait Implementations
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
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