Struct id_map::IdMap [] [src]

pub struct IdMap<T> { /* fields omitted */ }

A container that gives each item a unique id. Internally all elements are stored contiguously.

Methods

impl<T> IdMap<T>
[src]

Creates an empty IdMap<T>.

Creates an IdMap<T> with the specified capacity.

Removes all values from the map.

Returns the id that a subsequent call to insert() will produce.

Returns the number of id-value pairs in the map.

Returns the number of id-value pairs the map can hold before reallocating.

Resizes the map such that that capacity() >= cap.

Resizes the map to minimize allocated memory.

Returns a reference to the set of valid ids.

Inserts a value into an empty slot in the map and returns its id.

Inserts a value at a specific id, returning the old value if it existed.

Removes an id from the map, returning its value if it was previously in the map.

If the id has a value, returns it, otherwise inserts a new value.

If the id has a value, returns it, otherwise inserts a new value with the provided closure.

Removes all ids in the seset from the map.

Remove all values not satisfying the predicate.

Returns true if the map contains a value for the specified id.

Returns a reference to the value at the specified id if it is in the map.

Returns a mutable reference to the value at the specified id if it is in the map.

An iterator over ids, in increasing order.

An iterator over values, in order of increasing id.

A mutable iterator over values, in order of increasing id.

An iterator over id-value pairs, in order of increasing id.

A mutable iterator over id-value pairs, in order of increasing id.

A consuming iterator over id-value pairs, in order of increasing id.

Trait Implementations

impl<T> Drop for IdMap<T>
[src]

A method called when the value goes out of scope. Read more

impl<T: Clone> Clone for IdMap<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for IdMap<T>
[src]

Formats the value using the given formatter.

impl<T> Default for IdMap<T>
[src]

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

impl<T: Eq> Eq for IdMap<T>
[src]

impl<T: PartialEq> PartialEq for IdMap<T>
[src]

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

This method tests for !=.

impl<T> Extend<T> for IdMap<T>
[src]

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

impl<T> FromIterator<T> for IdMap<T>
[src]

Creates a value from an iterator. Read more

impl<T> FromIterator<(Id, T)> for IdMap<T>
[src]

Creates a value from an iterator. Read more

impl<'a, T> IntoIterator for &'a IdMap<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, T> IntoIterator for &'a mut IdMap<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<T> IntoIterator for IdMap<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<T> Index<Id> for IdMap<T>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<T> IndexMut<Id> for IdMap<T>
[src]

The method for the mutable indexing (container[index]) operation