[−][src]Struct storagevec::smap::StorageMap
A map object that with either use the tinymap TinyMap
or the hashbrown HashMap
as a
backing implementation. It will use the alloc
feature to control this.
Implementations
impl<K: Eq + Ord + Hash, V, const N: usize> StorageMap<K, V, N>
[src]
#[must_use]pub fn new() -> Self
[src]
Create a new, empty StorageMap
.
#[must_use]pub fn len(&self) -> usize
[src]
Get the length of this storage map.
#[must_use]pub fn is_empty(&self) -> bool
[src]
Tell whether or not the storage map is empty.
#[must_use]pub fn get(&self, key: &K) -> Option<&V>
[src]
Get an element from this map by its key.
#[must_use]pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
Get a mutable reference to an element by its key.
pub fn try_insert(&mut self, key: K, value: V) -> Result<Option<V>, (K, V)>
[src]
Insert a new element into this map. If the key already exists in the map, it returns the value previously held in that slot. Otherwise, it will return None.
Errors
It will return back the key-value pair if the insertion cannot be accomplished due to capacity overflow.
pub fn insert(&mut self, key: K, value: V) -> Option<V>
[src]
Insert a new element into this map.
pub fn remove_entry(&mut self, key: &K) -> Option<(K, V)>
[src]
Remove a key/value entry from this map.
pub fn remove(&mut self, key: &K) -> Option<V>
[src]
Remove a value from this map.
pub fn contains_key(&self, key: &K) -> bool
[src]
Tell whether this map contains a certain key.
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)>
[src]
Get an iterator that iterates over the key-value pairs in arbitrary order.
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
[src]
Get an iterator that iterates over the key-value pairs in arbitary order, mutably.
pub fn keys(&self) -> impl Iterator<Item = &K>
[src]
Get an iterator that iterates over the keys in arbitrary order.
pub fn values(&self) -> impl Iterator<Item = &V>
[src]
Get an iterator that iterates over the values in arbitrary order.
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
[src]
Get an iterator that iterates over the values in arbitrary order, mutably.
Trait Implementations
impl<K: Ord + Eq + Hash + Clone, V: Clone, const N: usize> Clone for StorageMap<K, V, N>
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K: Ord + Eq + Hash + Debug, V: Debug, const N: usize> Debug for StorageMap<K, V, N>
[src]
impl<K: Ord + Eq + Hash, V, const N: usize> Default for StorageMap<K, V, N>
[src]
impl<K: Ord + Eq + Hash, V, const N: usize> Extend<(K, V)> for StorageMap<K, V, N>
[src]
pub fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<K: Ord + Eq + Hash, V, const N: usize> FromIterator<(K, V)> for StorageMap<K, V, N>
[src]
pub fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]
impl<K: Ord + Eq + Hash, V, const N: usize> IntoIterator for StorageMap<K, V, N>
[src]
Auto Trait Implementations
impl<K, V, const N: usize> Send for StorageMap<K, V, N> where
K: Send,
V: Send,
[src]
K: Send,
V: Send,
impl<K, V, const N: usize> Sync for StorageMap<K, V, N> where
K: Sync,
V: Sync,
[src]
K: Sync,
V: Sync,
impl<K, V, const N: usize> Unpin for StorageMap<K, V, N> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,