pub enum Entry<'a, T, V, Ix: IndexType = DefaultIx> {
Vacant(VacantEntry<'a, T, V, Ix>),
Occupied(OccupiedEntry<'a, T, V, Ix>),
}
Expand description
A view into a single entry in an IntervalMap, which may either be vacant or occupied. This enum is constructed from the entry.
Variants§
Vacant(VacantEntry<'a, T, V, Ix>)
Occupied(OccupiedEntry<'a, T, V, Ix>)
Implementations§
Source§impl<'a, T, V, Ix: IndexType> Entry<'a, T, V, Ix>where
T: Copy + PartialOrd,
impl<'a, T, V, Ix: IndexType> Entry<'a, T, V, Ix>where
T: Copy + PartialOrd,
Sourcepub fn or_insert(self, default: V) -> &'a mut V
pub fn or_insert(self, default: V) -> &'a mut V
If value is missing, initializes it with the default
value.
In any case, returns a mutable reference to the value.
Sourcepub fn or_insert_with<F>(self, default: F) -> &'a mut Vwhere
F: FnOnce() -> V,
pub fn or_insert_with<F>(self, default: F) -> &'a mut Vwhere
F: FnOnce() -> V,
If value is missing, initializes it with a default()
function call.
In any case, returns a mutable reference to the value.
Sourcepub fn or_insert_with_interval<F>(self, default: F) -> &'a mut V
pub fn or_insert_with_interval<F>(self, default: F) -> &'a mut V
If value is missing, initializes it with a default(interval)
.
In any case, returns a mutable reference to the value.
Sourcepub fn and_modify<F>(self, f: F) -> Self
pub fn and_modify<F>(self, f: F) -> Self
If the entry is occupied, modifies the value with f
function, and returns a new entry.
Does nothing if the value was vacant.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, V, Ix> Freeze for Entry<'a, T, V, Ix>
impl<'a, T, V, Ix> RefUnwindSafe for Entry<'a, T, V, Ix>
impl<'a, T, V, Ix> Send for Entry<'a, T, V, Ix>
impl<'a, T, V, Ix> Sync for Entry<'a, T, V, Ix>
impl<'a, T, V, Ix> Unpin for Entry<'a, T, V, Ix>
impl<'a, T, V, Ix = u32> !UnwindSafe for Entry<'a, T, V, Ix>
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