Struct BTreeVec Copy item path Source pub struct BTreeVec<T, const B: usize = 12, A: Allocator = Global > { }Expand description A growable array (vector) implemented as a B+ tree.
Provides non-amortized O(log n) random accesses, insertions, and removals,
and O(n) iteration.
B is the branching factor. It must be at least 3. The standard library
uses a value of 6 for its B-tree structures. Larger values are better when
T is smaller.
§ Mathematical variables
For the purposes of specifying the time complexity of various operations,
n refers to the number of items in the vector.
Creates a new BTreeVec . Note that this function is implemented
only for the default value of B; see Self::create for an
equivalent that works with all values of B.
Creates a new BTreeVec with the given allocator. Note that this
function is implemented only for the default value of B; see
Self::create_in for an equivalent that works with all values of
B.
Creates a new BTreeVec . This function exists because
BTreeVec::new is implemented only for the default value of B.
Creates a new BTreeVec with the given allocator. This function
exists because BTreeVec::new_in is implemented only for the default
value of B.
Gets the length of the vector.
§ Time complexity
Constant.
Checks whether the vector is empty.
§ Time complexity
Constant.
Gets the item at index, or None if no such item exists.
§ Time complexity
Θ(log n ).
Gets a mutable reference to the item at index, or None if no such
item exists.
§ Time complexity
Θ(log n ).
Gets the first item in the vector, or None if the vector is empty.
§ Time complexity
Θ(log n ).
Gets a mutable reference to the first item in the vector, or None
if the vector is empty.
§ Time complexity
Θ(log n ).
Gets the last item in the vector, or None if the vector is empty.
§ Time complexity
Θ(log n ).
Gets a mutable reference to the last item in the vector, or None if
the vector is empty.
§ Time complexity
Θ(log n ).
Inserts item at index.
§ Panics
Panics if index is greater than self.len() .
§ Time complexity
Θ(log n ).
Inserts item at the end of the vector.
§ Time complexity
Θ(log n ).
Removes and returns the item at index.
§ Panics
Panics if index is not less than self.len() .
§ Time complexity
Θ(log n ).
Removes and returns the last item in the vector, or None if the
vector is empty.
§ Time complexity
Θ(log n ).
Gets an iterator that returns references to each item in the vector.
§ Time complexity
Iteration over the entire vector is Θ(n ).
Gets an iterator that returns mutable references to each item in the
vector.
§ Time complexity
Iteration over the entire vector is Θ(n ).
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more 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?
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self and
other values if one exists.
Read more Tests less than (for
self and
other) and is used by the
< operator.
Read more Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more Tests greater than (for
self and
other) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more 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.