pub struct EntityRegistry { /* private fields */ }Expand description
Registry of descriptors for entities known to the engine.
Keyed by the tuple (entity_type, name) so the same name can represent
distinct entities of different types (e.g. UserService as a class
and UserService as a trait are independent entries). Callers whose
entities collide on both type and name should use fully-qualified names
(e.g. "auth::init") to disambiguate.
Implementations§
Source§impl EntityRegistry
impl EntityRegistry
pub fn new() -> Self
Sourcepub fn insert(&mut self, descriptor: EntityDescriptor)
pub fn insert(&mut self, descriptor: EntityDescriptor)
Insert or replace an entity. Last write wins for a given
(entity_type, name) pair — different-type entries with the same
name coexist.
Sourcepub fn get(&self, entity_type: &str, name: &str) -> Option<&EntityDescriptor>
pub fn get(&self, entity_type: &str, name: &str) -> Option<&EntityDescriptor>
Look up by (entity_type, name) — the canonical registry key.
pub fn iter(&self) -> impl Iterator<Item = &EntityDescriptor>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for EntityRegistry
impl Clone for EntityRegistry
Source§fn clone(&self) -> EntityRegistry
fn clone(&self) -> EntityRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityRegistry
impl Debug for EntityRegistry
Source§impl Default for EntityRegistry
impl Default for EntityRegistry
Source§fn default() -> EntityRegistry
fn default() -> EntityRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EntityRegistry
impl RefUnwindSafe for EntityRegistry
impl Send for EntityRegistry
impl Sync for EntityRegistry
impl Unpin for EntityRegistry
impl UnsafeUnpin for EntityRegistry
impl UnwindSafe for EntityRegistry
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