Cursor

Struct Cursor 

Source
pub struct Cursor<'list, T: ?Sized + Types> { /* private fields */ }
Expand description

A shared cursor into a linked list.

This can be created by methods like PinList::cursor_ghost.

Each cursor conceptually points to a single item in the list. It can also point to the space between the start and end of the list, in which case it is called the ghost cursor.

This type is not Copy to prevent accidental copies, but its Clone implementation is just a bitwise copy — very cheap.

Implementations§

Source§

impl<'list, T: ?Sized + Types> Cursor<'list, T>

Source

pub fn move_next(&mut self)

Move the cursor to the next element in the linked list.

Source

pub fn move_previous(&mut self)

Move the cursor to the previous element in the linked list.

Source

pub fn list(&self) -> &'list PinList<T>

Retrieve a shared reference to the list this cursor uses.

Source

pub fn protected(&self) -> Option<&'list T::Protected>

Retrieve a shared reference to the protected data of this linked list node.

Returns None if the cursor is the ghost cursor.

Source

pub fn unprotected(&self) -> Option<&'list T::Unprotected>

Retrieve a shared reference to the unprotected data of this linked list node.

Returns None if the cursor is the ghost cursor.

Trait Implementations§

Source§

impl<T: ?Sized + Types> Clone for Cursor<'_, T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ?Sized + Types> Debug for Cursor<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ?Sized + Types> Send for Cursor<'_, T>
where PinList<T>: Sync,

Source§

impl<T: ?Sized + Types> Sync for Cursor<'_, T>
where PinList<T>: Sync,

Auto Trait Implementations§

§

impl<'list, T> Freeze for Cursor<'list, T>
where T: ?Sized,

§

impl<'list, T> !RefUnwindSafe for Cursor<'list, T>

§

impl<'list, T> Unpin for Cursor<'list, T>
where T: ?Sized,

§

impl<'list, T> !UnwindSafe for Cursor<'list, T>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.