pub struct EntityList<E: Entity>(/* private fields */);
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.
Implementations§
Source§impl<E: Entity<Def = EntityListNode<E, D>>, D> EntityList<E>
impl<E: Entity<Def = EntityListNode<E, D>>, D> EntityList<E>
pub fn empty() -> Self
pub fn is_empty(self) -> bool
pub fn iter(self) -> EntityListIter<E>
Sourcepub fn insert_first(&mut self, new_node: E, defs: &mut EntityDefs<E>)
pub fn insert_first(&mut self, new_node: E, defs: &mut EntityDefs<E>)
Insert new_node
(defined in defs
) at the start of self
.
Sourcepub fn insert_last(&mut self, new_node: E, defs: &mut EntityDefs<E>)
pub fn insert_last(&mut self, new_node: E, defs: &mut EntityDefs<E>)
Insert new_node
(defined in defs
) at the end of self
.
Sourcepub fn insert_before(&mut self, new_node: E, next: E, defs: &mut EntityDefs<E>)
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
.
Sourcepub fn prepend(&mut self, list_to_prepend: Self, defs: &mut EntityDefs<E>)
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
.
Sourcepub fn append(&mut self, list_to_append: Self, defs: &mut EntityDefs<E>)
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
.
Sourcepub fn remove(&mut self, node: E, defs: &mut EntityDefs<E>)
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>
impl<E: Clone + Entity> Clone for EntityList<E>
Source§fn clone(&self) -> EntityList<E>
fn clone(&self) -> EntityList<E>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<E: Entity> Default for EntityList<E>
impl<E: Entity> Default for EntityList<E>
impl<E: Copy + Entity> Copy for EntityList<E>
Auto Trait Implementations§
impl<E> Freeze for EntityList<E>where
E: Freeze,
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more