Struct onevec::OneVec[][src]

pub struct OneVec<T>(_);

A Vec<T> wrapper with one-based indices allowing for memory layout optimization, e.g. Option<NonZeroUsize> is the same size as usize (8 or 4 bytes on most platforms)

For detailed methods documentation, see Vec.

Methods

impl<T> OneVec<T>
[src]

Constructs a new, empty OneVec<T>. Does not allocate memory.

Constructs a new, empty OneVec with the specified capacity.

Creates a OneVec<T> from Vec<T>. This operation is a no-op.

Returns the number of elements the vector can hold without reallocating.

Reserves capacity for at least additional more elements to be inserted in the given OneVec<T>.

Reserves the minimum capacity for exactly additional more elements to be inserted in the given OneVec<T>.

Shrinks the capacity of the vector as much as possible.

Shortens the vector, keeping the first len elements and dropping the rest.

Extracts a slice containing the entire vector.

Extracts a mutable slice of the entire vector.

Consumes the OneVec<T>, returning the inner vector.

Removes an element from the vector and returns it.

Inserts an element at position index within the vector, shifting all elements after it to the right.

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

Retains only the elements specified by the predicate.

Removes all but the first of consecutive elements in the vector that resolve to the same key.

Removes all but the first of consecutive elements in the vector satisfying a given equality relation.

Appends an element to the back of a collection.

Removes the last element from a vector and returns it, or None if it is empty.

Moves all the elements of other into Self, leaving other empty.

Clears the vector, removing all values.

Returns the number of elements in the vector, also referred to as its 'length'.

Returns true if the vector contains no elements.

Splits the collection into two at the given index.

Returns a newly allocated Self. self contains elements [0, at), and the returned Self contains elements [at, len).

Returns an iterator over the vector.

Returns an iterator that allows modifying each value.

Trait Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Default> Default for OneVec<T>
[src]

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

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

Formats the value using the given formatter. Read more

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

impl<T: Hash> Hash for OneVec<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: PartialEq> PartialEq for OneVec<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> IntoIterator for OneVec<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<RangeFull> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeFull> for OneVec<T>
[src]

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

impl<T> Index<Range<NonZeroUsize>> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<Range<NonZeroUsize>> for OneVec<T>
[src]

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

impl<T> Index<RangeInclusive<NonZeroUsize>> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeInclusive<NonZeroUsize>> for OneVec<T>
[src]

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

impl<T> Index<RangeTo<NonZeroUsize>> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeTo<NonZeroUsize>> for OneVec<T>
[src]

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

impl<T> Index<RangeToInclusive<NonZeroUsize>> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeToInclusive<NonZeroUsize>> for OneVec<T>
[src]

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

impl<T> Index<RangeFrom<NonZeroUsize>> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeFrom<NonZeroUsize>> for OneVec<T>
[src]

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

impl<T> Index<NonZeroUsize> for OneVec<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<NonZeroUsize> for OneVec<T>
[src]

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

Auto Trait Implementations

impl<T> Send for OneVec<T> where
    T: Send

impl<T> Sync for OneVec<T> where
    T: Sync