Struct array_map::ArrayMap [−][src]
#[must_use]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
impl<K: Indexable, V: Clone, const N: usize> ArrayMap<K, V, N>
[src]
impl<K: Indexable, V: Clone, const N: usize> ArrayMap<K, V, N>
[src]pub fn from_value(v: V) -> Self
[src]
pub fn from_value(v: V) -> Self
[src]Returns a new ArrayMap
where all the values are initialized to the same value
impl<K: Indexable, V, const N: usize> ArrayMap<K, V, N>
[src]
impl<K: Indexable, V, const N: usize> ArrayMap<K, V, N>
[src]pub fn from_closure(f: impl FnMut(&K) -> V) -> Self
[src]
pub fn from_closure(f: impl FnMut(&K) -> V) -> Self
[src]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
pub fn iter(&self) -> impl Iterator<Item = (K, &V)> + '_
[src]
pub fn iter(&self) -> impl Iterator<Item = (K, &V)> + '_
[src]Returns an iterator over all the items in the map. Note that the keys are owned.
Trait Implementations
impl<'de, K: Deserialize<'de> + Indexable, V: Deserialize<'de>, const N: usize> Deserialize<'de> for ArrayMap<K, V, N>
[src]
impl<'de, K: Deserialize<'de> + Indexable, V: Deserialize<'de>, const N: usize> Deserialize<'de> for ArrayMap<K, V, N>
[src]fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl<K: Indexable, const M: usize, const S: usize> From<&'_ ArrayMap<K, AtomicBool, M>> for ArraySet<K, S>
[src]
impl<K: Indexable, const M: usize, const S: usize> From<&'_ ArrayMap<K, AtomicBool, M>> for ArraySet<K, S>
[src]fn from(m: &ArrayMap<K, AtomicBool, M>) -> Self
[src]
fn from(m: &ArrayMap<K, AtomicBool, M>) -> Self
[src]Performs the conversion.
impl<K: Indexable, const M: usize, const S: usize> From<ArrayMap<K, bool, M>> for ArraySet<K, S>
[src]
impl<K: Indexable, const M: usize, const S: usize> From<ArrayMap<K, bool, M>> for ArraySet<K, S>
[src]impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, bool, M>
[src]
impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, bool, M>
[src]impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, AtomicBool, M>
[src]
impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, AtomicBool, M>
[src]impl<K: Indexable, V, const N: usize> FromIterator<(K, V)> for ArrayMap<K, Option<V>, N>
[src]
impl<K: Indexable, V, const N: usize> FromIterator<(K, V)> for ArrayMap<K, Option<V>, N>
[src]fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]Creates a value from an iterator. Read more
impl<K: Serialize + Indexable, V: Serialize, const N: usize> Serialize for ArrayMap<K, V, N>
[src]
impl<K: Serialize + Indexable, V: Serialize, const N: usize> Serialize for ArrayMap<K, V, N>
[src]fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]Serialize this value into the given Serde serializer. Read more
impl<K, V: Copy, const N: usize> Copy for ArrayMap<K, V, N>
[src]
impl<K, V: Eq, const N: usize> Eq for ArrayMap<K, V, N>
[src]
Auto Trait Implementations
impl<K, V, const N: usize> Send for ArrayMap<K, V, N> where
V: Send,
V: Send,
impl<K, V, const N: usize> Sync for ArrayMap<K, V, N> where
V: Sync,
V: Sync,
impl<K, V, const N: usize> Unpin for ArrayMap<K, V, N> where
V: Unpin,
V: Unpin,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,