Struct cranelift_bforest::MapCursor
source · [−]pub struct MapCursor<'a, K, V, C> where
K: 'a + Copy,
V: 'a + Copy,
C: 'a + Comparator<K>, { /* private fields */ }
Expand description
A position in a Map
used to navigate and modify the ordered map.
A cursor always points at a key-value pair in the map, or “off the end” which is a position after the last entry in the map.
Implementations
sourceimpl<'a, K, V, C> MapCursor<'a, K, V, C> where
K: Copy,
V: Copy,
C: Comparator<K>,
impl<'a, K, V, C> MapCursor<'a, K, V, C> where
K: Copy,
V: Copy,
C: Comparator<K>,
sourcepub fn next(&mut self) -> Option<(K, V)>
pub fn next(&mut self) -> Option<(K, V)>
Move cursor to the next key-value pair and return it.
If the cursor reaches the end, return None
and leave the cursor at the off-the-end
position.
sourcepub fn prev(&mut self) -> Option<(K, V)>
pub fn prev(&mut self) -> Option<(K, V)>
Move cursor to the previous key-value pair and return it.
If the cursor is already pointing at the first entry, leave it there and return None
.
sourcepub fn value_mut(&mut self) -> Option<&mut V>
pub fn value_mut(&mut self) -> Option<&mut V>
Get a mutable reference to the current value, or None
if the cursor is at the end.
sourcepub fn goto(&mut self, elem: K) -> Option<V>
pub fn goto(&mut self, elem: K) -> Option<V>
Move this cursor to key
.
If key
is in the map, place the cursor at key
and return the corresponding value.
If key
is not in the set, place the cursor at the next larger element (or the end) and
return None
.
sourcepub fn goto_first(&mut self) -> Option<V>
pub fn goto_first(&mut self) -> Option<V>
Move this cursor to the first element.
Auto Trait Implementations
impl<'a, K, V, C> RefUnwindSafe for MapCursor<'a, K, V, C> where
C: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V, C> Send for MapCursor<'a, K, V, C> where
C: Sync,
K: Send,
V: Send,
impl<'a, K, V, C> Sync for MapCursor<'a, K, V, C> where
C: Sync,
K: Sync,
V: Sync,
impl<'a, K, V, C> Unpin for MapCursor<'a, K, V, C> where
K: Unpin,
V: Unpin,
impl<'a, K, V, C> !UnwindSafe for MapCursor<'a, K, V, C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more