[go: up one dir, main page]

Struct sid::IdVec [] [src]

pub struct IdVec<ID: Identifier, T> { /* 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, T> IdVec<ID, T>
[src]

[src]

Create an empty IdVec

[src]

Create an IdVec with preallocated storage

[src]

Create an IdVec by recycling a Vec and its content.

[src]

Consume the IdVec and create a Vec.

[src]

Exposes the internal Vec.

[src]

Number of elements in the IdVec

[src]

Returns true if the vector contains no elements.

[src]

Extracts a slice containing the entire vector.

[src]

Extracts a mutable slice containing the entire vector.

[src]

[src]

[src]

[src]

[src]

[src]

[src]

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

[src]

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

[src]

Iterate over the elements of the IdVec

[src]

Iterate over the elements of the IdVec

[src]

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

[src]

Reserves capacity for at least additional more elements to be inserted in the given vector.

[src]

Shrinks the capacity of the vector as much as possible.

[src]

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

[src]

Removes and returns the element at position index within the vector, shifting all elements after it to the left.

[src]

Removes an element from the vector and returns it. The removed element is replaced by the last element of the vector.

[src]

[src]

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

[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<T: Default, ID: Identifier> IdVec<ID, T>
[src]

[src]

[src]

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

Trait Implementations

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

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

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

[src]

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