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.

Returns true if there are no initialized elements in the array

Returns the number of initialized elements in the array

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.

Get the mutable slice of the array that has already been initialized.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.