pub trait IEntityListNodeID: IPoliciedID {
Show 13 methods
// Required methods
fn obj_load_head(obj: &Self::ObjectT) -> EntityListNodeHead<Self>;
fn obj_store_head(obj: &Self::ObjectT, head: EntityListNodeHead<Self>);
fn obj_is_sentinel(obj: &Self::ObjectT) -> bool;
fn new_sentinel_obj() -> Self::ObjectT;
fn on_push_prev(
self,
prev: Self,
alloc: &IDBoundAlloc<Self>,
) -> EntityListRes<Self>;
fn on_push_next(
self,
next: Self,
alloc: &IDBoundAlloc<Self>,
) -> EntityListRes<Self>;
fn on_unplug(self, alloc: &IDBoundAlloc<Self>) -> EntityListRes<Self>;
// Provided methods
fn is_sentinel(self, alloc: &IDBoundAlloc<Self>) -> bool { ... }
fn new_sentinel(alloc: &IDBoundAlloc<Self>) -> Self { ... }
fn get_prev_id(self, alloc: &IDBoundAlloc<Self>) -> Option<Self> { ... }
fn get_next_id(self, alloc: &IDBoundAlloc<Self>) -> Option<Self> { ... }
fn is_attached(self, alloc: &IDBoundAlloc<Self>) -> bool { ... }
fn comes_before(
self,
latter: Self,
alloc: &IDBoundAlloc<Self>,
) -> EntityListRes<Self, bool> { ... }
}Expand description
Trait required for an entity ID to be used as a node in EntityList.
Implementors must provide accessors to load/store the embedded
EntityListNodeHead inside the entity object, create sentinel objects,
and handle optional push/unplug signals. This trait lets the list logic
remain generic over different ID representations (pointer-based or
index-based).
Required Methods§
Sourcefn obj_load_head(obj: &Self::ObjectT) -> EntityListNodeHead<Self>
fn obj_load_head(obj: &Self::ObjectT) -> EntityListNodeHead<Self>
Load the EntityListNodeHead from the entity object.
Sourcefn obj_store_head(obj: &Self::ObjectT, head: EntityListNodeHead<Self>)
fn obj_store_head(obj: &Self::ObjectT, head: EntityListNodeHead<Self>)
NOTE: Entity Lists are internally mutable
Sourcefn obj_is_sentinel(obj: &Self::ObjectT) -> bool
fn obj_is_sentinel(obj: &Self::ObjectT) -> bool
Check if the entity object is a sentinel node.
Sourcefn new_sentinel_obj() -> Self::ObjectT
fn new_sentinel_obj() -> Self::ObjectT
Create a new sentinel entity object.
Sourcefn on_push_prev(
self,
prev: Self,
alloc: &IDBoundAlloc<Self>,
) -> EntityListRes<Self>
fn on_push_prev( self, prev: Self, alloc: &IDBoundAlloc<Self>, ) -> EntityListRes<Self>
Signal: invoked when this node is being added after prev node.
Sourcefn on_push_next(
self,
next: Self,
alloc: &IDBoundAlloc<Self>,
) -> EntityListRes<Self>
fn on_push_next( self, next: Self, alloc: &IDBoundAlloc<Self>, ) -> EntityListRes<Self>
Signal: invoked when this node is being added before next node.
Sourcefn on_unplug(self, alloc: &IDBoundAlloc<Self>) -> EntityListRes<Self>
fn on_unplug(self, alloc: &IDBoundAlloc<Self>) -> EntityListRes<Self>
Signal: invoked when this node is being unplugged from a list.
Provided Methods§
Sourcefn is_sentinel(self, alloc: &IDBoundAlloc<Self>) -> bool
fn is_sentinel(self, alloc: &IDBoundAlloc<Self>) -> bool
Check if this node ID is a sentinel.
Sourcefn new_sentinel(alloc: &IDBoundAlloc<Self>) -> Self
fn new_sentinel(alloc: &IDBoundAlloc<Self>) -> Self
Create a new sentinel node ID allocated from the given allocator.
Sourcefn get_prev_id(self, alloc: &IDBoundAlloc<Self>) -> Option<Self>
fn get_prev_id(self, alloc: &IDBoundAlloc<Self>) -> Option<Self>
Get the previous node ID, if any.
Sourcefn get_next_id(self, alloc: &IDBoundAlloc<Self>) -> Option<Self>
fn get_next_id(self, alloc: &IDBoundAlloc<Self>) -> Option<Self>
Get the next node ID, if any.
Sourcefn is_attached(self, alloc: &IDBoundAlloc<Self>) -> bool
fn is_attached(self, alloc: &IDBoundAlloc<Self>) -> bool
Check if this node is currently attached to a list.
Sourcefn comes_before(
self,
latter: Self,
alloc: &IDBoundAlloc<Self>,
) -> EntityListRes<Self, bool>
fn comes_before( self, latter: Self, alloc: &IDBoundAlloc<Self>, ) -> EntityListRes<Self, bool>
Check whether this node comes before another node in the same list.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.