Struct RawList

Source
pub struct RawList<G: GetLinks> { /* private fields */ }
Expand description

A linked list.

§Invariants

The links of objects added to a list are owned by the list.

Implementations§

Source§

impl<G: GetLinks> RawList<G>

Source

pub const fn new() -> Self

Constructs a new empty RawList.

Source

pub fn iter(&self) -> Iterator<'_, G>

Returns an iterator for the list starting at the first entry.

Source

pub const fn is_empty(&self) -> bool

Returns whether the RawList is empty.

Source

pub unsafe fn insert_after( &mut self, existing: &G::EntryType, new: &G::EntryType, ) -> bool

Inserts the given object after existing.

§Safety

Callers must ensure that existing points to a valid entry that is on the list.

Source

pub unsafe fn push_back(&mut self, new: &G::EntryType) -> bool

Adds the given object to the end (back) of the list.

Rawlist will save the reference as node ptr. The caller must ensure the validity of the reference while it is on the linked list.

Source

pub unsafe fn push_front(&mut self, new: &G::EntryType) -> bool

Adds the given object to the first (front) of the list.

Rawlist will save the reference as node ptr. The caller must ensure the validity of the reference while it is on the linked list.

Source

pub unsafe fn remove(&mut self, data: &G::EntryType) -> bool

Removes the given entry.

§Safety

Callers must ensure that data is either on this list or in no list. It being on another list leads to memory unsafety.

Source

pub fn pop_front(&mut self) -> Option<NonNull<G::EntryType>>

Get and Remove the first element of the list.

Source

pub fn cursor_front_mut(&mut self) -> CursorMut<'_, G>

Returns a mut cursor starting on the first element of the list.

Trait Implementations§

Source§

impl<'a, G: GetLinks> IntoIterator for &'a RawList<G>

Source§

type Item = &'a <G as GetLinks>::EntryType

The type of the elements being iterated over.
Source§

type IntoIter = Iterator<'a, G>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<G: GetLinks> Send for RawList<G>
where G::EntryType: Send,

Source§

impl<G: GetLinks> Sync for RawList<G>
where G::EntryType: Sync,

Auto Trait Implementations§

§

impl<G> Freeze for RawList<G>

§

impl<G> RefUnwindSafe for RawList<G>

§

impl<G> Unpin for RawList<G>

§

impl<G> UnwindSafe for RawList<G>

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.