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
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
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.
Creates a value from an iterator. Read more
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