Type Alias texcraft_stdext::collections::groupingmap::GroupingVec
source · pub type GroupingVec<V> = GroupingContainer<usize, V, Vec<Option<V>>>;
Expand description
Aliased Type§
struct GroupingVec<V> { /* private fields */ }
Implementations§
source§impl<K: Eq + Hash + Clone, V, T: BackingContainer<K, V>> GroupingContainer<K, V, T>
impl<K: Eq + Hash + Clone, V, T: BackingContainer<K, V>> GroupingContainer<K, V, T>
sourcepub fn insert(&mut self, key: K, val: V, scope: Scope) -> bool
pub fn insert(&mut self, key: K, val: V, scope: Scope) -> bool
Inserts the key, value pair in the provided scope.
sourcepub fn get(&self, key: &K) -> Option<&V>
pub fn get(&self, key: &K) -> Option<&V>
Retrieves the value at the provided key.
It is equivalent to obtaining the backing container using backing_container and calling the get method.
sourcepub fn begin_group(&mut self)
pub fn begin_group(&mut self)
Begins a new group.
sourcepub fn end_group(&mut self) -> Result<(), NoGroupToEndError>
pub fn end_group(&mut self) -> Result<(), NoGroupToEndError>
Attempts to end the current group. Returns an error if there is no group to end.
sourcepub fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
pub fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
Extends the GroupingMap
with (key, value) pairs.
let mut cat_colors = GroupingHashMap::default();
cat_colors.extend(std::array::IntoIter::new([
("paganini", "black"),
("mint", "ginger"),
]));
assert_eq!(cat_colors.get(&"paganini"), Some(&"black"));
assert_eq!(cat_colors.get(&"mint"), Some(&"ginger"));
sourcepub fn backing_container(&self) -> &T
pub fn backing_container(&self) -> &T
Gets an immutable reference to the backing container.
It is not possible to obtain a mutable reference to the backing container, as mutations applied through such a reference could not be rolled back.
sourcepub fn iter(&self) -> T::Iter<'_>
pub fn iter(&self) -> T::Iter<'_>
Iterate over all (key, value) tuples that are currently visible.
sourcepub fn iter_all(&self) -> IterAll<'_, K, V, T> ⓘ
pub fn iter_all(&self) -> IterAll<'_, K, V, T> ⓘ
Iterate over all (key, value) tuples in the container, including tuples that are not currently visible.
See the documentation on IterAll for information on how this iterator works.
To iterate over visible items only, use the GroupingContainer::iter method.