Struct option_vec::OptionVec [] [src]

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

An abstraction over Vec<Option<T>>

An element in an OptionVec<T> can be accessed by index and maintains its position when elements are removed from the container.

An element inserted into an OptionVec<T> will occupy the first available position in the container.

Methods

impl<T> OptionVec<T>
[src]

Creates an empty OptionVec<T>.

Creates an empty OptionVec<T> with capacity for n elements.

Returns a borrowed reference to the internal Vec<Option<T>>.

Returns a mutable reference to the internal Vec<Option<T>>.

Modification of this internal container is safe, but using methods such as Vec::insert or Vec::remove will invalidate existing indices.

Returns the allocated capacity for elements.

Returns the number of contained elements.

This operation is O(N), as all non-None elements must be individually counted.

Returns whether the container is empty.

This operation is O(N) worst-case, as any elements must be searched for a non-None element.

Inserts an element into the first available position, returning the destination position.

Removes an element from the given position, if one exists.

Reserves capacity for at least n more elements.

Reserves capacity for exactly n more elements.

Shrinks the allocation as much as possible.

Any trailing None elements will be truncated. None elements in internal positions are not removed, so as to maintain Some(_) element positions.

Retains only elements specified by the predicate.

All elements e such that f(&mut e) returns false will be assigned to None.

Removes and returns the last occupied element.

Removes and returns the first occupied element.

Removes all contained elements.

Returns whether an element exists at the given index.

Returns an element at the given position.

Returns a mutable reference to an element at the given position.

Returns an iterator over contained elements.

Returns an iterator over mutable references to contained elements.

Returns an iterator over values with indices.

The elements yielded by this iterator will be (usize, T).

Returns an iterator over references with indices.

The elements yielded by this iterator will be (usize, &T).

Returns an iterator over mutable references with indices.

The elements yielded by this iterator will be (usize, &mut T).

Trait Implementations

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

Formats the value using the given formatter.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

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

impl<T> From<Vec<Option<T>>> for OptionVec<T>
[src]

Performs the conversion.

impl<T> Into<Vec<Option<T>>> for OptionVec<T>
[src]

Performs the conversion.

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

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

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

Creates a value from an iterator. Read more

impl<'b, A, B> PartialEq<OptionVec<B>> for OptionVec<A> where A: PartialEq<B>
[src]

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

This method tests for !=.

impl<'b, A, B> PartialEq<Vec<B>> for OptionVec<A> where A: PartialEq<B>
[src]

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

This method tests for !=.

impl<'b, A, B> PartialEq<&'b [B]> for OptionVec<A> where A: PartialEq<B>
[src]

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

This method tests for !=.

impl<T> Eq for OptionVec<T> where T: Eq
[src]

impl<T> PartialOrd for OptionVec<T> where T: PartialOrd
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T> Ord for OptionVec<T> where T: Ord
[src]

This method returns an Ordering between self and other. Read more

impl<T> Index<usize> for OptionVec<T>
[src]

The returned type after indexing

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

impl<T> IndexMut<usize> for OptionVec<T>
[src]

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

impl<T> IntoIterator for OptionVec<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 OptionVec<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 OptionVec<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