Struct Cursor

Source
pub struct Cursor<T> { /* private fields */ }
Expand description

A type for bi-directional traversal and mutation of LinkedLists. See LinkedList::cursor_front and LinkedList::cursor_back to create one.

Implementations§

Source§

impl<T> Cursor<T>

Source

pub const fn list(self) -> LinkedList<T>

Source

pub const fn index(&self) -> Option<usize>

Source

pub const fn read(&self) -> Option<&T>

Source

pub const fn read_mut(&mut self) -> Option<&mut T>

Source

pub const fn read_next(&self) -> Option<&T>

Source

pub const fn read_next_mut(&mut self) -> Option<&mut T>

Source

pub const fn read_prev(&self) -> Option<&T>

Source

pub const fn read_prev_mut(&mut self) -> Option<&mut T>

Source

pub const fn move_next(&mut self) -> &mut Self

Source

pub const fn move_prev(&mut self) -> &mut Self

Source

pub fn push_next(&mut self, value: T)

Source

pub fn push_prev(&mut self, value: T)

Source

pub fn pop_next(&mut self) -> Option<T>

Source

pub fn pop_prev(&mut self) -> Option<T>

Source

pub const fn state<'a>(&'a self) -> State<'a, T>

Source

pub const fn state_mut<'a>(&'a mut self) -> StateMut<'a, T>

Source

pub const fn is_head(&self) -> bool

Source

pub const fn is_tail(&self) -> bool

Source

pub fn read_offset(&self, offset: isize) -> Option<&T>

Source

pub fn read_offset_mut(&mut self, offset: isize) -> Option<&mut T>

Source

pub const fn move_offset(&mut self, offset: isize) -> &mut Self

Source

pub fn move_to(&mut self, index: usize) -> &mut Self

Source

pub fn try_move_to( &mut self, index: usize, ) -> Result<&mut Self, IndexOutOfBounds>

Source

pub const fn split_before(self) -> (LinkedList<T>, LinkedList<T>)

Source

pub const fn split_after(self) -> (LinkedList<T>, LinkedList<T>)

Source§

impl<T> Cursor<T>

Source

pub const fn len(&self) -> usize

Source

pub const fn is_empty(&self) -> bool

Source

pub const fn front(&self) -> Option<&T>

Source

pub const fn front_mut(&mut self) -> Option<&mut T>

Source

pub const fn back(&self) -> Option<&T>

Source

pub const fn back_mut(&mut self) -> Option<&mut T>

Source

pub fn push_front(&mut self, value: T)

Source

pub fn push_back(&mut self, value: T)

Source

pub fn pop_front(&mut self) -> Option<T>

Source

pub fn pop_back(&mut self) -> Option<T>

Source

pub fn get(&self, index: usize) -> &T

Source

pub fn try_get(&self, index: usize) -> Option<&T>

Source

pub fn get_mut(&mut self, index: usize) -> &mut T

Source

pub fn try_get_mut(&mut self, index: usize) -> Option<&mut T>

Trait Implementations§

Source§

impl<T: Hash> Hash for Cursor<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Cursor<T>

§

impl<T> RefUnwindSafe for Cursor<T>
where T: RefUnwindSafe,

§

impl<T> !Send for Cursor<T>

§

impl<T> !Sync for Cursor<T>

§

impl<T> Unpin for Cursor<T>
where T: Unpin,

§

impl<T> UnwindSafe for Cursor<T>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.