Struct btree_vec::vec::BTreeVec

source ·
pub struct BTreeVec<T, const B: usize> { /* private fields */ }
Expand description

A growable array (vector) implemented as a B+ tree.

Provides O(log n) random accesses, insertions, and removals, and O(n) iteration.

B is the branching factor. It must be at least 4. The standard library uses a value of 6 for its B-tree structures. Larger values are better when T is smaller.

Implementations

Creates a new BTreeVec.

Gets the length of the vector.

Checks whether the vector is empty.

Gets the item at index, or None if no such item exists.

Gets a mutable reference to the item at index, or None if no such item exists.

Gets the first item in the vector, or None if the vector is empty.

Gets a mutable reference to the first item in the vector, or None if the vector is empty.

Gets the last item in the vector, or None if the vector is empty.

Gets a mutable reference to the last item in the vector, or None if the vector is empty.

Inserts item at index.

Panics

Panics if index is greater than self.len().

Inserts item at the end of the vector.

Removes and returns the item at index.

Panics

Panics if index is not less than self.len().

Removes and returns the last item in the vector, or None if the vector is empty.

Gets an iterator that returns references to each item in the vector.

Gets an iterator that returns mutable references to each item in the vector.

Trait Implementations

Returns the “default value” for a type. Read more
Executes the destructor for this type. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
Performs the mutable indexing (container[index]) operation. Read more
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
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
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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.