pub struct InstanceView<'a> { /* private fields */ }Expand description
Read-only borrow of one instance’s state.
Implementations§
Source§impl<'a> InstanceView<'a>
impl<'a> InstanceView<'a>
Sourcepub fn id(&self) -> InstanceId
pub fn id(&self) -> InstanceId
InstanceId of the viewed instance.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Number of entities currently registered.
Sourcepub fn component_count(&self) -> usize
pub fn component_count(&self) -> usize
Total component count across all entities.
Sourcepub fn local_tick(&self) -> u64
pub fn local_tick(&self) -> u64
Logical local tick of the instance.
Sourcepub fn entity_meta(&self, entity: EntityId) -> Option<&'a EntityMeta>
pub fn entity_meta(&self, entity: EntityId) -> Option<&'a EntityMeta>
Per-entity metadata. None if the entity is not registered.
Sourcepub fn component(
&self,
entity: EntityId,
type_code: TypeCode,
) -> Option<&'a Bytes>
pub fn component( &self, entity: EntityId, type_code: TypeCode, ) -> Option<&'a Bytes>
Component bytes for an (entity, type_code) pair. None if
the component is not attached to that entity.
Sourcepub fn entities(&self) -> impl Iterator<Item = (EntityId, &'a EntityMeta)> + 'a
pub fn entities(&self) -> impl Iterator<Item = (EntityId, &'a EntityMeta)> + 'a
Iterate every (entity, &meta) in ascending EntityId order
(A23 canonical, supplied by BTreeMap iteration).
Sourcepub fn components_by_type(
&self,
type_code: TypeCode,
) -> impl Iterator<Item = (EntityId, &'a Bytes)> + 'a
pub fn components_by_type( &self, type_code: TypeCode, ) -> impl Iterator<Item = (EntityId, &'a Bytes)> + 'a
Iterate every (entity, &bytes) whose component matches
type_code. Useful for “list all posts” / “list all rolls”
style queries without exposing the raw component map.
Order: ascending EntityId (A23 canonical).
Auto Trait Implementations§
impl<'a> Freeze for InstanceView<'a>
impl<'a> RefUnwindSafe for InstanceView<'a>
impl<'a> Send for InstanceView<'a>
impl<'a> Sync for InstanceView<'a>
impl<'a> Unpin for InstanceView<'a>
impl<'a> UnsafeUnpin for InstanceView<'a>
impl<'a> UnwindSafe for InstanceView<'a>
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