Struct Cursor
pub struct Cursor<'a, K: 'a> { pub(in ::collections::btree::set) inner: Cursor<'a, K, SetValZST> }
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.
Fields
inner: Cursor<'a, K, SetValZST>
Implementations
impl<'a, K> Cursor<'a, K>
fn next(&mut self) -> Option<&'a K>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
Noneis returned and the cursor is not moved.fn prev(&mut self) -> Option<&'a K>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
Noneis returned and the cursor is not moved.fn peek_next(&self) -> Option<&'a K>Returns a reference to next element without moving the cursor.
If the cursor is at the end of the set then
Noneis returnedfn peek_prev(&self) -> Option<&'a K>Returns a reference to the previous element without moving the cursor.
If the cursor is at the start of the set then
Noneis returned.
Trait Implementations
impl<'a, K: Clone + 'a> Clone for Cursor<'a, K>
fn clone(&self) -> Cursor<'a, K>
impl<K: Debug> Debug for Cursor<'_, K>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a, K> Freeze for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: Freeze,
impl<'a, K> RefUnwindSafe for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: RefUnwindSafe,
impl<'a, K> Send for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: Send,
impl<'a, K> Sync for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: Sync,
impl<'a, K> Unpin for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: Unpin,
impl<'a, K> UnsafeUnpin for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: UnsafeUnpin,
impl<'a, K> UnwindSafe for Cursor<'a, K>
where
Cursor<'a, K, SetValZST>: UnwindSafe,
Blanket Implementations
impl<T> Any for Cursor<'a, K>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Cursor<'a, K>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Cursor<'a, K>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Cursor<'a, K>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Cursor<'a, K>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Cursor<'a, K>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Cursor<'a, K>
impl<T> ToOwned for Cursor<'a, K>
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>
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>
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>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>