Struct Cursor
pub struct Cursor<'a, K: 'a, V: 'a> { pub(in ::collections::btree::map) current: Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>, pub(in ::collections::btree::map) root: Option<&'a NodeRef<Owned, K, V, LeafOrInternal>> }
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.
Fields
current: Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>root: Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>
Implementations
impl<'a, K, V> Cursor<'a, K, V>
fn next(&mut self) -> Option<(&'a K, &'a V)>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
Noneis returned and the cursor is not moved.fn prev(&mut self) -> Option<(&'a K, &'a V)>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
Noneis returned and the cursor is not moved.fn peek_next(&self) -> Option<(&'a K, &'a V)>Returns a reference to the key and value of the next element without moving the cursor.
If the cursor is at the end of the map then
Noneis returned.fn peek_prev(&self) -> Option<(&'a K, &'a V)>Returns a reference to the key and value of the previous element without moving the cursor.
If the cursor is at the start of the map then
Noneis returned.
Trait Implementations
impl<K, V> Clone for Cursor<'_, K, V>
fn clone(&self) -> Self
impl<K: Debug, V: Debug> Debug for Cursor<'_, K, V>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a, K, V> Freeze for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: Freeze,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: Freeze,
impl<'a, K, V> RefUnwindSafe for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: RefUnwindSafe,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: RefUnwindSafe,
impl<'a, K, V> Send for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: Send,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: Send,
impl<'a, K, V> Sync for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: Sync,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: Sync,
impl<'a, K, V> Unpin for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: Unpin,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: Unpin,
impl<'a, K, V> UnsafeUnpin for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: UnsafeUnpin,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: UnsafeUnpin,
impl<'a, K, V> UnwindSafe for Cursor<'a, K, V>
where
Option<Handle<NodeRef<Immut<'a>, K, V, Leaf>, Edge>>: UnwindSafe,
Option<&'a NodeRef<Owned, K, V, LeafOrInternal>>: UnwindSafe,
Blanket Implementations
impl<T> Any for Cursor<'a, K, V>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Cursor<'a, K, V>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Cursor<'a, K, V>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Cursor<'a, K, V>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Cursor<'a, K, V>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Cursor<'a, K, V>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Cursor<'a, K, V>
impl<T> ToOwned for Cursor<'a, K, V>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Cursor<'a, K, V>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Cursor<'a, K, V>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Cursor<'a, K, V>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>