Struct spirt::context::EntityList

source ·
pub struct EntityList<E: Entity>(Option<FirstLast<E, E>>);
Expand description

Doubly-linked list, “intrusively” going through E::Def, which must be an EntityListNode<E, _> (to hold the “previous/next node” links).

Fields are private to avoid arbitrary user interactions.

Tuple Fields§

§0: Option<FirstLast<E, E>>

Implementations§

source§

impl<E: Entity<Def = EntityListNode<E, D>>, D> EntityList<E>

source

pub fn empty() -> Self

source

pub fn is_empty(self) -> bool

source

pub fn iter(self) -> EntityListIter<E>

source

pub fn insert_first(&mut self, new_node: E, defs: &mut EntityDefs<E>)

Insert new_node (defined in defs) at the start of self.

source

pub fn insert_last(&mut self, new_node: E, defs: &mut EntityDefs<E>)

Insert new_node (defined in defs) at the end of self.

source

pub fn insert_before(&mut self, new_node: E, next: E, defs: &mut EntityDefs<E>)

Insert new_node (defined in defs) into self, before next.

source

pub fn prepend(&mut self, list_to_prepend: Self, defs: &mut EntityDefs<E>)

Insert all of list_to_prepend’s nodes at the start of self.

source

pub fn append(&mut self, list_to_append: Self, defs: &mut EntityDefs<E>)

Insert all of list_to_append’s nodes at the end of self.

source

fn concat(a: Self, b: Self, defs: &mut EntityDefs<E>) -> Self

Private helper for prepend/append.

source

pub fn remove(&mut self, node: E, defs: &mut EntityDefs<E>)

Remove node (defined in defs) from self.

Trait Implementations§

source§

impl<E: Clone + Entity> Clone for EntityList<E>

source§

fn clone(&self) -> EntityList<E>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<E: Entity> Default for EntityList<E>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<E: Copy + Entity> Copy for EntityList<E>

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for EntityList<E>
where E: RefUnwindSafe,

§

impl<E> Send for EntityList<E>
where E: Send,

§

impl<E> Sync for EntityList<E>
where E: Sync,

§

impl<E> Unpin for EntityList<E>
where E: Unpin,

§

impl<E> UnwindSafe for EntityList<E>
where E: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.