pub struct EnumMap<T: EnumArrayHelper<V>, V> { /* private fields */ }
Expand description
A total map from enumoid T
to values V
.
Implementations§
source§impl<T: EnumArrayHelper<V>, V: Default> EnumMap<T, V>
impl<T: EnumArrayHelper<V>, V: Default> EnumMap<T, V>
source§impl<T: EnumArrayHelper<V>, V> EnumMap<T, V>
impl<T: EnumArrayHelper<V>, V> EnumMap<T, V>
sourcepub fn new_with<F>(f: F) -> Selfwhere
F: FnMut(T) -> V,
pub fn new_with<F>(f: F) -> Selfwhere
F: FnMut(T) -> V,
Creates a new map populated by a callback function.
sourcepub fn as_slice_mut(&mut self) -> &mut [V]
pub fn as_slice_mut(&mut self) -> &mut [V]
Returns a mutable slice containing all the values in the map.
sourcepub fn get_by_index(&self, index: EnumIndex<T>) -> &V
pub fn get_by_index(&self, index: EnumIndex<T>) -> &V
Returns a reference to the value associated with a given index.
sourcepub fn get_by_index_mut(&mut self, index: EnumIndex<T>) -> &mut V
pub fn get_by_index_mut(&mut self, index: EnumIndex<T>) -> &mut V
Returns a mutable reference to the value associated with a given index.
Trait Implementations§
source§impl<'de, T: EnumArrayHelper<V> + EnumSetHelper<u8> + Deserialize<'de>, V: Deserialize<'de>> Deserialize<'de> for EnumMap<T, V>
impl<'de, T: EnumArrayHelper<V> + EnumSetHelper<u8> + Deserialize<'de>, V: Deserialize<'de>> Deserialize<'de> for EnumMap<T, V>
source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: EnumArrayHelper<V>, V> Index<T> for EnumMap<T, V>
impl<T: EnumArrayHelper<V>, V> Index<T> for EnumMap<T, V>
source§impl<T: EnumArrayHelper<V>, V> IndexMut<T> for EnumMap<T, V>
impl<T: EnumArrayHelper<V>, V> IndexMut<T> for EnumMap<T, V>
source§impl<'a, T: EnumArrayHelper<V>, V> IntoIterator for &'a EnumMap<T, V>
impl<'a, T: EnumArrayHelper<V>, V> IntoIterator for &'a EnumMap<T, V>
source§impl<'a, T: EnumArrayHelper<V>, V> IntoIterator for &'a mut EnumMap<T, V>
impl<'a, T: EnumArrayHelper<V>, V> IntoIterator for &'a mut EnumMap<T, V>
source§impl<T: EnumArrayHelper<V>, V: PartialEq> PartialEq for EnumMap<T, V>
impl<T: EnumArrayHelper<V>, V: PartialEq> PartialEq for EnumMap<T, V>
source§impl<T: EnumArrayHelper<V> + EnumSetHelper<u8>, V> TryFrom<EnumOptionMap<T, V>> for EnumMap<T, V>
impl<T: EnumArrayHelper<V> + EnumSetHelper<u8>, V> TryFrom<EnumOptionMap<T, V>> for EnumMap<T, V>
impl<T: EnumArrayHelper<V>, V: Copy> Copy for EnumMap<T, V>where
T::TotalArray: Copy,
impl<T: EnumArrayHelper<V>, V: Eq> Eq for EnumMap<T, V>
Auto Trait Implementations§
impl<T, V> RefUnwindSafe for EnumMap<T, V>
impl<T, V> Send for EnumMap<T, V>
impl<T, V> Sync for EnumMap<T, V>
impl<T, V> Unpin for EnumMap<T, V>
impl<T, V> UnwindSafe for EnumMap<T, V>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more