pub struct Cursor<'a, K: 'a, V: 'a> { /* private fields */ }
🔬This is a nightly-only experimental API. (
btree_cursors
#107540)Available on non-crate feature
ferrocene_certified
only.Expand description
A cursor over a BTreeMap
.
A Cursor
is like an iterator, except that it can freely seek back-and-forth.
Cursors always point to a gap between two elements in the map, and can operate on the two immediately adjacent elements.
A Cursor
is created with the BTreeMap::lower_bound
and BTreeMap::upper_bound
methods.
Implementations§
Source§impl<'a, K, V> Cursor<'a, K, V>
impl<'a, K, V> Cursor<'a, K, V>
Sourcepub fn next(&mut self) -> Option<(&'a K, &'a V)>
🔬This is a nightly-only experimental API. (btree_cursors
#107540)
pub fn next(&mut self) -> Option<(&'a K, &'a V)>
btree_cursors
#107540)Advances the cursor to the next gap, returning the key and value of the element that it moved over.
If the cursor is already at the end of the map then None
is returned
and the cursor is not moved.
Sourcepub fn prev(&mut self) -> Option<(&'a K, &'a V)>
🔬This is a nightly-only experimental API. (btree_cursors
#107540)
pub fn prev(&mut self) -> Option<(&'a K, &'a V)>
btree_cursors
#107540)Advances the cursor to the previous gap, returning the key and value of the element that it moved over.
If the cursor is already at the start of the map then None
is returned
and the cursor is not moved.
Trait Implementations§
Auto Trait Implementations§
impl<'a, K, V> Freeze for Cursor<'a, K, V>
impl<'a, K, V> RefUnwindSafe for Cursor<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for Cursor<'a, K, V>
impl<'a, K, V> Sync for Cursor<'a, K, V>
impl<'a, K, V> Unpin for Cursor<'a, K, V>
impl<'a, K, V> UnwindSafe for Cursor<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
Source§type Owned = T
type Owned = T
Available on non-crate feature
ferrocene_certified
only.The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> T
fn to_owned(&self) -> T
Available on non-crate feature
ferrocene_certified
only.Creates owned data from borrowed data, usually by cloning. Read more
Source§fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Available on non-crate feature
ferrocene_certified
only.Uses borrowed data to replace owned data, usually by cloning. Read more