EntityList

Struct EntityList 

Source
pub struct EntityList<I: IEntityListNodeID> {
    pub head: I,
    pub tail: I,
    pub len: Cell<usize>,
}

Fields§

§head: I§tail: I§len: Cell<usize>

Implementations§

Source§

impl<I: IEntityListNodeID> EntityList<I>

Source

pub fn new(alloc: &EntityAlloc<I::ObjectT, I::PolicyT>) -> Self

create a new empty list with head and tail sentinels linked with each other.

Source

pub fn len(&self) -> usize

get the number of nodes in the list.

Source

pub fn is_empty(&self) -> bool

check if the list is empty.

Source

pub fn get_front_id( &self, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> Option<I>

try to get the front node ID, or None if the list is empty

Source

pub fn get_back_id( &self, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> Option<I>

try to get the back node ID, or None if the list is empty

Source

pub fn node_add_next( &self, node: I, new_node: I, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I>

Add a new node after an existing node linked to this list.

If the current node is linked to another list, then the operation is undefined. You’ll get a broken list without reporting an error.

§Signal invocation

node_add_next will invoke on_push_next on node before modifying any links. If the signal returns an error, the operation is aborted without modifying any links.

Source

pub fn node_add_prev( &self, node: I, new_node: I, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I>

Add a new node before an existing node linked to this list.

If the current node is linked to another list, then the operation is undefined. You’ll get a broken list without reporting an error.

§Signal invocation

node_add_prev will invoke on_push_prev on node before modifying any links. If the signal returns an error, the operation is aborted without modifying any links.

Source

pub fn node_unplug( &self, node: I, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I>

Unplug a node from the list.

§Signal invocation

node_unplug will invoke on_unplug on node before modifying any links. If the signal returns an error, the operation is aborted without modifying any links.

Source

pub fn push_back_id( &self, new_node: I, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I>

Push a new node to the back of the list.

Source

pub fn push_front_id( &self, new_node: I, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I>

Push a new node to the front of the list.

Source

pub fn pop_back( &self, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I, I>

Pop a node from the back of the list.

Source

pub fn pop_front( &self, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRes<I, I>

Pop a node from the front of the list.

Source

pub fn get_range( &self, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListRange<I>

Source

pub fn get_range_with_sentinels(&self) -> EntityListRange<I>

Source

pub fn iter<'alloc>( &self, alloc: &'alloc EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListIter<'alloc, I>

Source

pub fn iter_with_sentinels<'alloc>( &self, alloc: &'alloc EntityAlloc<I::ObjectT, I::PolicyT>, ) -> EntityListIter<'alloc, I>

Source

pub fn forall_with_sentinel( &self, alloc: &EntityAlloc<I::ObjectT, I::PolicyT>, f: impl FnMut(I, &I::ObjectT) -> EntityListRes<I>, ) -> EntityListRes<I, ()>

Auto Trait Implementations§

§

impl<I> !Freeze for EntityList<I>

§

impl<I> !RefUnwindSafe for EntityList<I>

§

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

§

impl<I> !Sync for EntityList<I>

§

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

§

impl<I> UnwindSafe for EntityList<I>
where I: 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, 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.