Struct Cursor
struct Cursor<'a, T: 'a, A: Allocator = crate::alloc::Global> { ... }
A cursor over a LinkedList.
A Cursor is like an iterator, except that it can freely seek back-and-forth.
Cursors always rest between two elements in the list, and index in a logically circular way.
To accommodate this, there is a "ghost" non-element that yields None between the head and
tail of the list.
When created, cursors start at the front of the list, or the "ghost" non-element if the list is empty.
Implementations
impl<'a, T, A: Allocator> Cursor<'a, T, A>
fn index(self: &Self) -> Option<usize>Returns the cursor position index within the
LinkedList.This returns
Noneif the cursor is currently pointing to the "ghost" non-element.fn move_next(self: &mut Self)Moves the cursor to the next element of the
LinkedList.If the cursor is pointing to the "ghost" non-element then this will move it to the first element of the
LinkedList. If it is pointing to the last element of theLinkedListthen this will move it to the "ghost" non-element.fn move_prev(self: &mut Self)Moves the cursor to the previous element of the
LinkedList.If the cursor is pointing to the "ghost" non-element then this will move it to the last element of the
LinkedList. If it is pointing to the first element of theLinkedListthen this will move it to the "ghost" non-element.fn current(self: &Self) -> Option<&'a T>Returns a reference to the element that the cursor is currently pointing to.
This returns
Noneif the cursor is currently pointing to the "ghost" non-element.fn peek_next(self: &Self) -> Option<&'a T>Returns a reference to the next element.
If the cursor is pointing to the "ghost" non-element then this returns the first element of the
LinkedList. If it is pointing to the last element of theLinkedListthen this returnsNone.fn peek_prev(self: &Self) -> Option<&'a T>Returns a reference to the previous element.
If the cursor is pointing to the "ghost" non-element then this returns the last element of the
LinkedList. If it is pointing to the first element of theLinkedListthen this returnsNone.fn front(self: &Self) -> Option<&'a T>Provides a reference to the front element of the cursor's parent list, or None if the list is empty.
fn back(self: &Self) -> Option<&'a T>Provides a reference to the back element of the cursor's parent list, or None if the list is empty.
fn as_list(self: &Self) -> &'a LinkedList<T, A>Provides a reference to the cursor's parent list.
impl<'a, T, A> Freeze for Cursor<'a, T, A>
impl<'a, T, A> RefUnwindSafe for Cursor<'a, T, A>
impl<'a, T, A> Unpin for Cursor<'a, T, A>
impl<'a, T, A> UnwindSafe for Cursor<'a, T, A>
impl<T> Any for Cursor<'a, T, A>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Cursor<'a, T, A>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Cursor<'a, T, A>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Cursor<'a, T, A>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Cursor<'a, T, A>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Cursor<'a, T, A>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, A: Allocator> Clone for Cursor<'_, T, A>
fn clone(self: &Self) -> Self
impl<T, U> Into for Cursor<'a, T, A>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Cursor<'a, T, A>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Cursor<'a, T, A>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T: Sync, A: Allocator + Sync> Send for Cursor<'_, T, A>
impl<T: Sync, A: Allocator + Sync> Sync for Cursor<'_, T, A>
impl<T: fmt::Debug, A: Allocator> Debug for Cursor<'_, T, A>
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result