Skip to main content

Cursor

Struct Cursor 

Source
pub struct Cursor<'a, T, Typ>
where T: Pointee<Metadata = DynMetadata<T>> + ?Sized + 'a, Typ: ListType<T>,
{ /* private fields */ }
Expand description

Cursor into a DynList.

The cursor has a different API than the iterator, and only lends out elements. In exchange, it has operations that can remove elements from the list.

Implementations§

Source§

impl<'a, T, Typ> Cursor<'a, T, Typ>
where T: Pointee<Metadata = DynMetadata<T>> + ?Sized, Typ: ListType<T>,

Source

pub fn current(&mut self) -> &mut T

Gets the current element that the cursor is at.

The element’s lifetime is tied to the cursor rather than the list.

Source

pub fn move_next(&mut self) -> bool

Move to the next element.

If this returns true, the cursor has been moved. If false, the cursor is already at the last element and the cursor was not moved.

Source

pub fn drop_after(self)

Drops all elements from the cursor’s current position to the end of the list.

Includes the element that the cursor is on.

Source§

impl<'a, T, Typ> Cursor<'a, T, Typ>
where T: Pointee<Metadata = DynMetadata<T>> + ?Sized, Typ: ListTypeRev<T>,

Source

pub fn move_prev(&mut self) -> bool

Move to the previous element.

If this returns true, the cursor has been moved. If false, the cursor is already at the first element and the cursor was not moved.

Auto Trait Implementations§

§

impl<'a, T, Typ> !UnwindSafe for Cursor<'a, T, Typ>

§

impl<'a, T, Typ> Freeze for Cursor<'a, T, Typ>
where &'a mut DynList<T, Typ>: Freeze, T: ?Sized,

§

impl<'a, T, Typ> RefUnwindSafe for Cursor<'a, T, Typ>
where &'a mut DynList<T, Typ>: RefUnwindSafe, T: ?Sized,

§

impl<'a, T, Typ> Send for Cursor<'a, T, Typ>
where &'a mut DynList<T, Typ>: Send, T: ?Sized,

§

impl<'a, T, Typ> Sync for Cursor<'a, T, Typ>
where &'a mut DynList<T, Typ>: Sync, T: ?Sized,

§

impl<'a, T, Typ> Unpin for Cursor<'a, T, Typ>
where &'a mut DynList<T, Typ>: Unpin, T: ?Sized,

§

impl<'a, T, Typ> UnsafeUnpin for Cursor<'a, T, Typ>
where &'a mut DynList<T, Typ>: UnsafeUnpin, T: ?Sized,

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> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.