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 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
Returns an iterator over all the keys in the map. Note that the keys are owned.
Turns this into an array of mutable references to the original. Useful for calling [map] when all you need are mutable references
Panics
Can only panic if K::iter() is unstable or doesn’t meet requirements
Turns this into an array of references to the original. Useful for calling [map] when all you need are references
Panics
Can only panic if K::iter() is unstable or doesn’t meet requirements
Trait Implementations
impl<'de, K: Deserialize<'de> + Indexable, V: Deserialize<'de>, const N: usize> Deserialize<'de> for ArrayMap<K, V, N>
impl<'de, K: Deserialize<'de> + Indexable, V: Deserialize<'de>, const N: usize> Deserialize<'de> for ArrayMap<K, V, N>
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<K, V, const N: usize> RefUnwindSafe for ArrayMap<K, V, N> where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more