[−][src]Trait idmap::table::EntryTable
Stores an IdMap
's actual entries, which controls the actual behavior of the map.
There are currently two primary implementations:
DenseEntryTable
stores the entries more mompactly and preserves insertion order, but it needs a seperateIdTable
to map the keys to indexes in the entry list.DirectEntryTable
doesn't need any extraIdTable
book-keeping or indirection in order to associate keys with entries, though it can't preserve ordering and wastes more space when keys are missing. For these reasons, it's not the default though it can be used as an optimization when you know that the key indexes of the entries will be densely packed.
Required methods
fn new() -> Self
fn with_capacity(capacity: usize) -> Self
fn len(&self) -> usize
fn get(&self, key: &K) -> Option<&V>
fn get_mut(&mut self, key: &K) -> Option<&mut V>
fn insert(&mut self, key: K, value: V) -> Option<V>
fn insert_vacant(&mut self, key: K, value: V) -> &mut V
fn swap_remove(&mut self, key: &K) -> Option<V>
fn retain<F>(&mut self, func: F) where
F: FnMut(&K, &mut V) -> bool,
F: FnMut(&K, &mut V) -> bool,
Retain the specified entries in the map, returning if any indexes changed
fn clear(&mut self)
fn reserve(&mut self, amount: usize)
fn raw_debug(&self) -> &dyn Debug where
K: Debug,
V: Debug,
K: Debug,
V: Debug,
fn max_id(&self) -> Option<u64>
fn cloned(&self) -> Self where
K: Clone,
V: Clone,
K: Clone,
V: Clone,
Provided methods
Loading content...Implementors
impl<K: IntegerId, V> EntryTable<K, V> for DirectEntryTable<K, V>
[src]
fn new() -> Self
[src]
fn with_capacity(capacity: usize) -> Self
[src]
fn len(&self) -> usize
[src]
fn get(&self, key: &K) -> Option<&V>
[src]
fn get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
fn insert(&mut self, key: K, value: V) -> Option<V>
[src]
fn insert_vacant(&mut self, key: K, value: V) -> &mut V
[src]
fn swap_remove(&mut self, key: &K) -> Option<V>
[src]
fn retain<F>(&mut self, func: F) where
F: FnMut(&K, &mut V) -> bool,
[src]
F: FnMut(&K, &mut V) -> bool,
fn clear(&mut self)
[src]
fn reserve(&mut self, amount: usize)
[src]
fn raw_debug(&self) -> &dyn Debug where
K: Debug,
V: Debug,
[src]
K: Debug,
V: Debug,
fn max_id(&self) -> Option<u64>
[src]
fn cloned(&self) -> Self where
K: Clone,
V: Clone,
[src]
K: Clone,
V: Clone,
impl<K: IntegerId, V, T: IdTable> EntryTable<K, V> for DenseEntryTable<K, V, T>
[src]
fn new() -> Self
[src]
fn with_capacity(capacity: usize) -> Self
[src]
fn len(&self) -> usize
[src]
fn get(&self, key: &K) -> Option<&V>
[src]
fn get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
fn insert(&mut self, key: K, value: V) -> Option<V>
[src]
fn insert_vacant(&mut self, key: K, value: V) -> &mut V
[src]
fn swap_remove(&mut self, key: &K) -> Option<V>
[src]
fn retain<F>(&mut self, func: F) where
F: FnMut(&K, &mut V) -> bool,
[src]
F: FnMut(&K, &mut V) -> bool,
fn clear(&mut self)
[src]
fn reserve(&mut self, amount: usize)
[src]
fn raw_debug(&self) -> &dyn Debug where
K: Debug,
V: Debug,
[src]
K: Debug,
V: Debug,
fn max_id(&self) -> Option<u64>
[src]
fn cloned(&self) -> Self where
K: Clone,
V: Clone,
[src]
K: Clone,
V: Clone,