pub struct Cursor<'a, K: 'a, V: 'a> { /* private fields */ }
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 an element in the tree, and index in a logically circular way.
To accommodate this, there is a “ghost” non-element that yields None
between the last and
first elements of the tree.
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 key(&self) -> Option<&'a K>
pub fn key(&self) -> Option<&'a K>
Returns a reference to the key of the element that the cursor is currently pointing to.
This returns None
if the cursor is currently pointing to the “ghost”
non-element.
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)