Struct sid_vec::IdVec [] [src]

pub struct IdVec<ID: Identifier, Data> { /* fields omitted */ }

Similar to Vec except that it is indexed using an Id rather than an usize index. if the stored type implements Default, IdVec can also use the set(...) method which can grow the vector to accomodate for the requested id.

Methods

impl<ID: Identifier, Data> IdVec<ID, Data>
[src]

Create an empty IdVec

Create an IdVec with preallocated storage

Create an IdVec by recycling a Vec and its content.

Consume the IdVec and create a Vec.

Number of elements in the IdVec

Return the nth element of the IdVec using an usize index rather than an Id (à la Vec).

Return the nth element of the IdVec using an usize index rather than an Id (à la Vec).

Iterate over the elements of the IdVec

Iterate over the elements of the IdVec

Add an element to the IdVec and return its Id. This method can cause the storage to be reallocated.

Drop all of the contained elements and clear the IdVec's storage.

impl<ID: Identifier, Data: Default> IdVec<ID, Data>
[src]

Set the value for a certain Id, possibly adding default values if the Id's index is Greater than the size of the underlying vector.

impl<Data: Default, ID: Identifier> IdVec<ID, Data>
[src]

Creates an IdVec with an n elements initialized to Default::default.

Trait Implementations

impl<ID: Identifier, Data> Index<ID> for IdVec<ID, Data>
[src]

The returned type after indexing

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

impl<ID: Identifier, Data> IndexMut<ID> for IdVec<ID, Data>
[src]

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