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
Converts from the binary_search result type into the FindOrInsert type
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§impl PartialOrd for FindOrInsert
impl PartialOrd for FindOrInsert
impl Eq for FindOrInsert
impl StructuralPartialEq for FindOrInsert
Auto Trait Implementations§
impl Freeze for FindOrInsert
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