Trait zerovec::map::ZeroVecLike [−][src]
pub trait ZeroVecLike<'a, T: ?Sized> {
type NeedleType: ?Sized;
type GetType: ?Sized;
type OwnedType;
Show 13 methods
fn binary_search(&self, k: &Self::NeedleType) -> Result<usize, usize>;
fn get(&self, index: usize) -> Option<&Self::GetType>;
fn insert(&mut self, index: usize, value: &T);
fn remove(&mut self, index: usize) -> Self::OwnedType;
fn replace(&mut self, index: usize, value: &T) -> Self::OwnedType;
fn push(&mut self, value: &T);
fn len(&self) -> usize;
fn new() -> Self;
fn with_capacity(cap: usize) -> Self;
fn clear(&mut self);
fn reserve(&mut self, addl: usize);
fn is_ascending(&self) -> bool;
fn is_empty(&self) -> bool { ... }
}
Expand description
Trait abstracting over ZeroVec
and VarZeroVec
, for use in ZeroMap
. You
should not be implementing or calling this trait directly.
Associated Types
type NeedleType: ?Sized
type NeedleType: ?Sized
The type received by Self::binary_search()
Required methods
fn binary_search(&self, k: &Self::NeedleType) -> Result<usize, usize>
fn binary_search(&self, k: &Self::NeedleType) -> Result<usize, usize>
Search for a key in a sorted vector, returns Ok(index)
if found,
returns Err(insert_index)
if not found, where insert_index
is the
index where it should be inserted to maintain sort order.
Remove the element at index
(panicking if nonexistant)
Replace the element at index
with another one, returning the old element
fn with_capacity(cap: usize) -> Self
fn with_capacity(cap: usize) -> Self
Create a new, empty vector, with given capacity
fn is_ascending(&self) -> bool
fn is_ascending(&self) -> bool
Check if this vector is in ascending order according to T
s Ord
impl