pub struct MapCursor<'a, K, V, C>{ /* 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§
source§impl<'a, K, V, C> MapCursor<'a, K, V, C>
impl<'a, K, V, C> MapCursor<'a, K, V, C>
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.