Trait flatbox_ecs::GenericWorld
source · pub trait GenericWorld {
// Required methods
fn to_ref<T>(&self) -> SubWorldRaw<&World, T>
where T: ComponentBorrow + Subset;
fn try_query<Q>(&self) -> Result<QueryBorrow<'_, Q>, Error>
where Q: Query + Subset;
fn try_query_one<Q>(&self, entity: Entity) -> Result<QueryOne<'_, Q>, Error>
where Q: Query + Subset;
fn try_get<C>(&self, entity: Entity) -> Result<Ref<'_, C>, Error>
where C: Component;
fn try_get_mut<C>(&self, entity: Entity) -> Result<RefMut<'_, C>, Error>
where C: Component;
fn reserve(&self) -> Entity;
// Provided method
fn to_empty(&self) -> SubWorldRaw<&World, ()> { ... }
}
Expand description
Trait for allowing function to work on both World and SubWorld
Required Methods§
sourcefn to_ref<T>(&self) -> SubWorldRaw<&World, T>where
T: ComponentBorrow + Subset,
fn to_ref<T>(&self) -> SubWorldRaw<&World, T>where
T: ComponentBorrow + Subset,
Convert the subworld into another holding an internal reference to the original world.
sourcefn try_query<Q>(&self) -> Result<QueryBorrow<'_, Q>, Error>
fn try_query<Q>(&self) -> Result<QueryBorrow<'_, Q>, Error>
Queries the world
sourcefn try_query_one<Q>(&self, entity: Entity) -> Result<QueryOne<'_, Q>, Error>
fn try_query_one<Q>(&self, entity: Entity) -> Result<QueryOne<'_, Q>, Error>
Queries the world for a specific entity
sourcefn try_get<C>(&self, entity: Entity) -> Result<Ref<'_, C>, Error>where
C: Component,
fn try_get<C>(&self, entity: Entity) -> Result<Ref<'_, C>, Error>where
C: Component,
Get a single component for an entity Returns the contextual result since hecs-schedule is required to be imported anyway
Provided Methods§
sourcefn to_empty(&self) -> SubWorldRaw<&World, ()>
fn to_empty(&self) -> SubWorldRaw<&World, ()>
Transform this into a subworld which borrows no components. This is useful for concurrent access of entities.
Object Safety§
This trait is not object safe.