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
sourceimpl<T, const B: usize> BTreeVec<T, B>
impl<T, const B: usize> BTreeVec<T, B>
sourcepub fn get(&self, index: usize) -> Option<&T>
pub fn get(&self, index: usize) -> Option<&T>
Gets the item at index, or None if no such item exists.
sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Gets a mutable reference to the item at index, or None if no such
item exists.
sourcepub fn first(&self) -> Option<&T>
pub fn first(&self) -> Option<&T>
Gets the first item in the vector, or None if the vector is empty.
sourcepub fn first_mut(&mut self) -> Option<&mut T>
pub fn first_mut(&mut self) -> Option<&mut T>
Gets a mutable reference to the first item in the vector, or None
if the vector is empty.
sourcepub fn last(&self) -> Option<&T>
pub fn last(&self) -> Option<&T>
Gets the last item in the vector, or None if the vector is empty.
sourcepub fn last_mut(&mut self) -> Option<&mut T>
pub fn last_mut(&mut self) -> Option<&mut T>
Gets a mutable reference to the last item in the vector, or None if
the vector is empty.
sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Removes and returns the last item in the vector, or None if the
vector is empty.