Skip to main content

IdMapExt

Trait IdMapExt 

Source
pub trait IdMapExt<K: KeyType, V> {
    // Required methods
    fn insert_value(&mut self, value: V) -> K;
    fn windows(&self, size: usize) -> IntoIter<Vec<(K, &V)>>;
}
Expand description

Operations on an IdMap that IndexMap does not provide directly.

Required Methods§

Source

fn insert_value(&mut self, value: V) -> K

Insert value under a freshly generated default id, returning that id. The id is max(existing ids) + 1, so existing keys never shift and the result never collides with a live entry.

Source

fn windows(&self, size: usize) -> IntoIter<Vec<(K, &V)>>

Iterate over contiguous windows of size consecutive entries, with keys copied out. Mirrors slice::windows.

Implementors§

Source§

impl<K: KeyType, V> IdMapExt<K, V> for IdMap<K, V>