pub struct BinaryVec<T> { /* private fields */ }Implementations§
Source§impl<T: Ord> BinaryVec<T>
impl<T: Ord> BinaryVec<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new BinaryVec with the specified capacity.
Sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over references to the items in the BinaryVec.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns an iterator over mutable references to the items in the BinaryVec.
Sourcepub fn insert(&mut self, value: T) -> usize
pub fn insert(&mut self, value: T) -> usize
Inserts a value into the BinaryVec, maintaining sorted order, and returns the index where
the value was inserted.
Sourcepub fn get(&self, index: usize) -> Option<&T>
pub fn get(&self, index: usize) -> Option<&T>
Returns the item at the specified index, or None if the index is out of bounds.
Sourcepub fn get_index(&self, value: &T) -> Option<usize>
pub fn get_index(&self, value: &T) -> Option<usize>
Returns the index of the specified value, or None if the value is not found.
Sourcepub fn remove(&mut self, index: usize) -> Option<T>
pub fn remove(&mut self, index: usize) -> Option<T>
Removes the item at the specified index, returning it if it exists, or None if the index
is out of bounds.
Sourcepub fn remove_item(&mut self, value: &T) -> Option<T>
pub fn remove_item(&mut self, value: &T) -> Option<T>
Removes the specified item from the BinaryVec, returning it if it exists, or None if the
item is not found.
Sourcepub fn contains(&self, value: &T) -> bool
pub fn contains(&self, value: &T) -> bool
Checks if the BinaryVec contains the specified value.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements that can be stored in the BinaryVec without reallocating.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted in the BinaryVec.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the BinaryVec to fit its current length.
Sourcepub fn resize(&mut self, new_len: usize, value: T)where
T: Clone,
pub fn resize(&mut self, new_len: usize, value: T)where
T: Clone,
Resizes the BinaryVec to contain new_len elements, filling new elements with value.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable reference to the underlying vector.