Struct array_map::ArrayMap[][src]

pub struct ArrayMap<K, V, const N: usize> { /* fields omitted */ }
Expand description

A Map backed by an array. The keys must be known statically.

This map is O(1) for all operations. All members must be initialized at creation time so there is no option to insert or remove items from the map. Because of this it can be indexed into using the key type.

Implementations

Function that can be used in const contexts to get a new ArrayMap.

Callers should ensure that each V in the array matches the return of index() from K to get back expected results.

Returns a new ArrayMap where all the values are initialized to the same value

Returns a new ArrayMap where all the values are initialized to the value returned from each call of the closure.

Panics

Panics if K::iter() returns anything other than N items or if K::index() returns a value >= N

Returns a new ArrayMap where all the values are initialized to the same value

Errors

Returns an error the first time that the provided closure returns an error.

Panics

Panics if K::iter() returns anything other than N items or if K::index() returns a value >= N

Collects an iterator of (K, Result<V, E>) into a Result<Self, E>

The trait FromIterator cannot be implemented for Result like it is on a Vec because of the orphan rules.

Errors

Returns an error with the first emitted error from the provided iterator

Panics

Panics if any of the safety requirements in the Indexable trait are wrong

Collects an iterator of (K, Option<V>) into an Option<Self>

Panics

Panics if any of the safety requirements in the Indexable trait are wrong

Returns an iterator over all the items in the map. Note that the keys are owned.

Panics

Panics if any of the safety requirements in the Indexable trait are wrong

Returns a mutable iterator over all the items in the map

Panics

Panics if any of the safety requirements in the Indexable trait are wrong

Returns an iterator over all the keys in the map. Note that the keys are owned.

Returns an iterator over all the values in the map

Returns a mutable iterator over all the values in the map

Trait Implementations

Performs the conversion.

Performs the conversion.

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

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Creates a value from an iterator. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. 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)

recently added

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.