Skip to main content

InstanceView

Struct InstanceView 

Source
pub struct InstanceView<'a> { /* private fields */ }
Expand description

Read-only borrow of one instance’s state.

Implementations§

Source§

impl<'a> InstanceView<'a>

Source

pub fn id(&self) -> InstanceId

InstanceId of the viewed instance.

Source

pub fn entity_count(&self) -> usize

Number of entities currently registered.

Source

pub fn component_count(&self) -> usize

Total component count across all entities.

Source

pub fn local_tick(&self) -> u64

Logical local tick of the instance.

Source

pub fn entity_meta(&self, entity: EntityId) -> Option<&'a EntityMeta>

Per-entity metadata. None if the entity is not registered.

Source

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.

Source

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).

Source

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.