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

Create a new, empty ArrayBuilder

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.

Returns true if no elements in the array are initialized.

Returns the number of initialized elements in the 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.

Add an initialized element to the array.

Panics

Panics 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.

Return the fully initialized array.

Panics

Panics if the array isn’t fully initialized yet.

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

Returns the “default value” for a type. Read more

Extends a collection with the contents of an iterator. Read more

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

Extends a collection with exactly one element.

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

Reserves capacity in a collection for the given number of additional elements. 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.