pub struct Cursor<'a, K: 'a> { /* private fields */ }
🔬This is a nightly-only experimental API. (
btree_cursors
#107540)Expand description
A cursor over a BTreeSet
.
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 set, and can operate on the two immediately adjacent elements.
A Cursor
is created with the BTreeSet::lower_bound
and BTreeSet::upper_bound
methods.
Implementations§
Source§impl<'a, K> Cursor<'a, K>
impl<'a, K> Cursor<'a, K>
Sourcepub fn next(&mut self) -> Option<&'a K>
🔬This is a nightly-only experimental API. (btree_cursors
#107540)
pub fn next(&mut self) -> Option<&'a K>
btree_cursors
#107540)Advances the cursor to the next gap, returning the element that it moved over.
If the cursor is already at the end of the set then None
is returned
and the cursor is not moved.
Sourcepub fn prev(&mut self) -> Option<&'a K>
🔬This is a nightly-only experimental API. (btree_cursors
#107540)
pub fn prev(&mut self) -> Option<&'a K>
btree_cursors
#107540)Advances the cursor to the previous gap, returning the element that it moved over.
If the cursor is already at the start of the set then None
is returned
and the cursor is not moved.
Trait Implementations§
Auto Trait Implementations§
impl<'a, K> Freeze for Cursor<'a, K>
impl<'a, K> RefUnwindSafe for Cursor<'a, K>where
K: RefUnwindSafe,
impl<'a, K> Send for Cursor<'a, K>where
K: Sync,
impl<'a, K> Sync for Cursor<'a, K>where
K: Sync,
impl<'a, K> Unpin for Cursor<'a, K>
impl<'a, K> UnwindSafe for Cursor<'a, K>where
K: 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