pub enum Entry<'a, K: Key, V: Value, S: Stats> {
Occupied(OccupiedEntry<'a, K, V, S>),
Vacant(VacantEntry<'a, K, V, S>),
}Expand description
Entry into a BTreeMap for in-place manipulation
Variants§
Occupied(OccupiedEntry<'a, K, V, S>)
Vacant(VacantEntry<'a, K, V, S>)
Implementations§
Source§impl<'a, K: Key, V: Value, S: Stats> Entry<'a, K, V, S>
impl<'a, K: Key, V: Value, S: Stats> Entry<'a, K, V, S>
pub fn exists(&self) -> bool
Sourcepub fn or_insert(self, default: V) -> &'a mut Vwhere
K: Ord + 'a,
pub fn or_insert(self, default: V) -> &'a mut Vwhere
K: Ord + 'a,
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
Sourcepub fn or_insert_with<F>(self, default: F) -> &'a mut V
pub fn or_insert_with<F>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.
Sourcepub fn and_modify<F>(self, f: F) -> Self
pub fn and_modify<F>(self, f: F) -> Self
Provides in-place mutable access to an occupied entry before any potential inserts into the tree.
Sourcepub fn move_backward(self) -> Result<OccupiedEntry<'a, K, V, S>, Self>
pub fn move_backward(self) -> Result<OccupiedEntry<'a, K, V, S>, Self>
Move to previous OccupiedEntry
When reaching the front, return the original entry in Err()
Sourcepub fn move_forward(self) -> Result<OccupiedEntry<'a, K, V, S>, Self>
pub fn move_forward(self) -> Result<OccupiedEntry<'a, K, V, S>, Self>
Move to next OccupiedEntry
When reaching the end, return the original entry in Err()
Sourcepub fn peek_backward<'b>(&'b self) -> Option<(&'b K, &'b V)>
pub fn peek_backward<'b>(&'b self) -> Option<(&'b K, &'b V)>
Peak previous OccupiedEntry
Sourcepub fn peek_forward<'b>(&'b self) -> Option<(&'b K, &'b V)>
pub fn peek_forward<'b>(&'b self) -> Option<(&'b K, &'b V)>
Peak the next OccupiedEntry
Trait Implementations§
Auto Trait Implementations§
impl<'a, K, V, S> !Sync for Entry<'a, K, V, S>
impl<'a, K, V, S> Freeze for Entry<'a, K, V, S>
impl<'a, K, V, S> RefUnwindSafe for Entry<'a, K, V, S>
impl<'a, K, V, S> Send for Entry<'a, K, V, S>
impl<'a, K, V, S> Unpin for Entry<'a, K, V, S>
impl<'a, K, V, S> UnsafeUnpin for Entry<'a, K, V, S>
impl<'a, K, V, S> UnwindSafe for Entry<'a, K, V, S>
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