Struct spirt::EntityList
source · 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> 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