Trait idmap::table::EntryTable [] [src]

pub trait EntryTable<K: IntegerId, V>: EntryIterable<K, V> + IntoIterator<Item = (K, V)> {
    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
;
fn clear(&mut self);
fn reserve(&mut self, amount: usize);
fn raw_debug(&self) -> &Debug
    where
        K: Debug,
        V: Debug
;
fn max_id(&self) -> Option<u64>;
fn cloned(&self) -> Self
    where
        K: Clone,
        V: Clone
; fn is_empty(&self) -> bool { ... } }

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 seperate IdTable to map the keys to indexes in the entry list.
  • DirectEntryTable doesn't need any extra IdTable 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

Retain the specified entries in the map, returning if any indexes changed

Provided Methods

Implementors