Enum sorted_vec::FindOrInsert
source · pub enum FindOrInsert {
Found(usize),
Inserted(usize),
}
Expand description
Value returned when find_or_insert is used.
Variants§
Implementations§
source§impl FindOrInsert
impl FindOrInsert
sourcepub fn found(&self) -> Option<usize>
pub fn found(&self) -> Option<usize>
If an equivalent element was found in the container, get the value of its index. Otherwise get None.
sourcepub fn inserted(&self) -> Option<usize>
pub fn inserted(&self) -> Option<usize>
If the provided element was inserted into the container, get the value of its index. Otherwise get None.
sourcepub fn is_inserted(&self) -> bool
pub fn is_inserted(&self) -> bool
Returns true if the element was inserted.
Trait Implementations§
source§impl Debug for FindOrInsert
impl Debug for FindOrInsert
source§impl From<Result<usize, usize>> for FindOrInsert
impl From<Result<usize, usize>> for FindOrInsert
Converts from the binary_search result type into the FindOrInsert type
source§impl Hash for FindOrInsert
impl Hash for FindOrInsert
source§impl Ord for FindOrInsert
impl Ord for FindOrInsert
source§fn cmp(&self, other: &FindOrInsert) -> Ordering
fn cmp(&self, other: &FindOrInsert) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for FindOrInsert
impl PartialEq for FindOrInsert
source§fn eq(&self, other: &FindOrInsert) -> bool
fn eq(&self, other: &FindOrInsert) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for FindOrInsert
impl PartialOrd for FindOrInsert
source§fn partial_cmp(&self, other: &FindOrInsert) -> Option<Ordering>
fn partial_cmp(&self, other: &FindOrInsert) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for FindOrInsert
impl StructuralEq for FindOrInsert
impl StructuralPartialEq for FindOrInsert
Auto Trait Implementations§
impl RefUnwindSafe for FindOrInsert
impl Send for FindOrInsert
impl Sync for FindOrInsert
impl Unpin for FindOrInsert
impl UnwindSafe for FindOrInsert
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more