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

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 same value

Panics

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

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

Returns a mutable iterator over all the items in the map

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

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.

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

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