pub struct Cursor<T> { /* private fields */ }
Expand description
A type for bi-directional traversal and mutation of LinkedList
s. See
LinkedList::cursor_front
and LinkedList::cursor_back
to create one.
Implementations§
Source§impl<T> Cursor<T>
impl<T> Cursor<T>
pub const fn list(self) -> LinkedList<T>
pub const fn index(&self) -> Option<usize>
pub const fn read(&self) -> Option<&T>
pub const fn read_mut(&mut self) -> Option<&mut T>
pub const fn read_next(&self) -> Option<&T>
pub const fn read_next_mut(&mut self) -> Option<&mut T>
pub const fn read_prev(&self) -> Option<&T>
pub const fn read_prev_mut(&mut self) -> Option<&mut T>
pub const fn move_next(&mut self) -> &mut Self
pub const fn move_prev(&mut self) -> &mut Self
pub fn push_next(&mut self, value: T)
pub fn push_prev(&mut self, value: T)
pub fn pop_next(&mut self) -> Option<T>
pub fn pop_prev(&mut self) -> Option<T>
pub const fn state<'a>(&'a self) -> State<'a, T>
pub const fn state_mut<'a>(&'a mut self) -> StateMut<'a, T>
pub const fn is_head(&self) -> bool
pub const fn is_tail(&self) -> bool
pub fn read_offset(&self, offset: isize) -> Option<&T>
pub fn read_offset_mut(&mut self, offset: isize) -> Option<&mut T>
pub const fn move_offset(&mut self, offset: isize) -> &mut Self
pub fn move_to(&mut self, index: usize) -> &mut Self
pub fn try_move_to( &mut self, index: usize, ) -> Result<&mut Self, IndexOutOfBounds>
pub const fn split_before(self) -> (LinkedList<T>, LinkedList<T>)
pub const fn split_after(self) -> (LinkedList<T>, LinkedList<T>)
Source§impl<T> Cursor<T>
impl<T> Cursor<T>
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn front(&self) -> Option<&T>
pub const fn front_mut(&mut self) -> Option<&mut T>
pub const fn back(&self) -> Option<&T>
pub const fn back_mut(&mut self) -> Option<&mut T>
pub fn push_front(&mut self, value: T)
pub fn push_back(&mut self, value: T)
pub fn pop_front(&mut self) -> Option<T>
pub fn pop_back(&mut self) -> Option<T>
pub fn get(&self, index: usize) -> &T
pub fn try_get(&self, index: usize) -> Option<&T>
pub fn get_mut(&mut self, index: usize) -> &mut T
pub fn try_get_mut(&mut self, index: usize) -> Option<&mut T>
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more