Struct idmap::IdMap[][src]

pub struct IdMap<K: IntegerId, V, T: EntryTable<K, V> = DenseEntryTable<K, V>> { /* fields omitted */ }

A map of mostly-contiguous IntegerId keys to values, backed by a Vec.

This is parametric over the type of the underlying EntryTable, which controls its behavior By default it's equivelant to an OrderedIdMap, though you can explicitly request a DirectIdMap instead.

From the user's presepctive, this is equivelant to a nice wrapper around a Vec<Option<(K, V)>>, that preserves insertion order and saves some space for missing keys. More details on the possible internal representations are documented in the OrderedIdMap and DirectIdMap aliases.

Methods

impl<K: IntegerId, V> IdMap<K, V, DirectEntryTable<K, V>>
[src]

impl<K: IntegerId, V> IdMap<K, V>
[src]

Create an empty IdMap using a DenseEntryTable and OrderedIdTable

Create an IdMap with the specified capacity, using an OrderedIdTable

impl<K: IntegerId, V, T: EntryTable<K, V>> IdMap<K, V, T>
[src]

Create an empty IdMap with a custom entry table type.

Create a new IdMap with the specified capacity but a custom entry table.

Important traits for Iter<'a, K, V, I>

Important traits for IterMut<'a, K, V, I>

Important traits for Keys<'a, K, V, I>

Important traits for Values<'a, K, V, I>

Important traits for ValuesMut<'a, K, V, I>

Retains only the elements specified by the predicate.

let mut map: IdMap<usize, usize> = (0..8).map(|x|(x, x*10)).collect();
map.retain(|k, _| k % 2 == 0);
assert_eq!(
    map.into_iter().collect::<Vec<_>>(),
    vec![(0, 0), (2, 20), (4, 40), (6, 60)]
);

Reserve space for the specified number of additional elements

Give a wrapper that will debug the underlying representation of this IdMap

Trait Implementations

impl<'de, K, V, T> Deserialize<'de> for IdMap<K, V, T> where
    K: Deserialize<'de>,
    T: EntryTable<K, V>,
    K: IntegerId,
    V: Deserialize<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl<K, V, T> Serialize for IdMap<K, V, T> where
    K: IntegerId,
    K: Serialize,
    V: Serialize,
    T: EntryTable<K, V>, 
[src]

Serialize this value into the given Serde serializer. Read more

impl<K, V, T> Clone for IdMap<K, V, T> where
    K: IntegerId + Clone,
    V: Clone,
    T: EntryTable<K, V>, 
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<K, V1, T1, V2, T2> PartialEq<IdMap<K, V2, T2>> for IdMap<K, V1, T1> where
    K: IntegerId,
    V1: PartialEq<V2>,
    T1: EntryTable<K, V1>,
    T2: EntryTable<K, V2>, 
[src]

Checks if two have the same contents, ignoring the order.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<K: IntegerId, V, T: EntryTable<K, V>> Default for IdMap<K, V, T>
[src]

Returns the "default value" for a type. Read more

impl<K: IntegerId, V, T: EntryTable<K, V>> Index<K> for IdMap<K, V, T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<K: IntegerId, V, T: EntryTable<K, V>> IndexMut<K> for IdMap<K, V, T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<'a, K: IntegerId, V, T: EntryTable<K, V>> Index<&'a K> for IdMap<K, V, T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a, K: IntegerId, V, T: EntryTable<K, V>> IndexMut<&'a K> for IdMap<K, V, T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<K: IntegerId, V: Debug, T: EntryTable<K, V>> Debug for IdMap<K, V, T>
[src]

Formats the value using the given formatter. Read more

impl<K: IntegerId, V, T: EntryTable<K, V>> IntoIterator for IdMap<K, V, T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, K: IntegerId + 'a, V: 'a, T: 'a> IntoIterator for &'a IdMap<K, V, T> where
    T: EntryTable<K, V>, 
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, K, V, T> IntoIterator for &'a mut IdMap<K, V, T> where
    T: EntryTable<K, V>,
    K: IntegerId + 'a,
    V: 'a,
    T: 'a, 
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<K: IntegerId, V, T: EntryTable<K, V>> Extend<(K, V)> for IdMap<K, V, T>
[src]

Extends a collection with the contents of an iterator. Read more

impl<K: IntegerId, V, T: EntryTable<K, V>> FromIterator<(K, V)> for IdMap<K, V, T>
[src]

Creates a value from an iterator. Read more

impl<'a, K, V, T> FromIterator<(&'a K, &'a V)> for IdMap<K, V, T> where
    K: IntegerId + Clone + 'a,
    V: Clone + 'a,
    T: EntryTable<K, V>, 
[src]

Creates a value from an iterator. Read more

impl<'a, K, V, T> Extend<(&'a K, &'a V)> for IdMap<K, V, T> where
    K: IntegerId + Clone + 'a,
    V: Clone + 'a,
    T: EntryTable<K, V>, 
[src]

Extends a collection with the contents of an iterator. Read more

Auto Trait Implementations

impl<K, V, T> Send for IdMap<K, V, T> where
    K: Send,
    T: Send,
    V: Send

impl<K, V, T> Sync for IdMap<K, V, T> where
    K: Sync,
    T: Sync,
    V: Sync