pub struct World { /* private fields */ }Expand description
This type stores everything that is offered by this crate. It is the main type of the ECS. It exposes the API for the ECS, it is the bedrock of the engine.
Implementations§
Source§impl World
impl World
Create a new empty World (just like World::default), but with a custom tag factory (instead of an empty one).
This is useful because you can’t change the tag factory after assigning it to the world.
Source§impl World
impl World
Sourcepub fn get_tag_tracker(&self, entity: EntityId) -> TagTracker
pub fn get_tag_tracker(&self, entity: EntityId) -> TagTracker
Get the TagTracker of an entity.
Source§impl World
impl World
Sourcepub fn query<Q>(&mut self) -> impl Iterator<Item = <Q as ArchQuery>::Item<'_>>where
Q: ArchQuery,
pub fn query<Q>(&mut self) -> impl Iterator<Item = <Q as ArchQuery>::Item<'_>>where
Q: ArchQuery,
Query the world for components.
Sourcepub fn query_filtered<'a, Q, F>(
&'a mut self,
) -> impl Iterator<Item = <Q as ArchQuery>::Item<'a>> + 'awhere
Q: ArchQuery + 'a,
F: ArchFilter + 'a,
pub fn query_filtered<'a, Q, F>(
&'a mut self,
) -> impl Iterator<Item = <Q as ArchQuery>::Item<'a>> + 'awhere
Q: ArchQuery + 'a,
F: ArchFilter + 'a,
Query the world for components, with a filter.
Source§impl World
impl World
Sourcepub fn spawn<B>(&mut self, bundle: B) -> EntityId
pub fn spawn<B>(&mut self, bundle: B) -> EntityId
Spawn a new entity with a bundle of components.
Sourcepub fn get_component<C>(&self, entity: EntityId) -> Option<&C>where
C: Component,
pub fn get_component<C>(&self, entity: EntityId) -> Option<&C>where
C: Component,
Get a reference to a Component of an entity.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for World
impl RefUnwindSafe for World
impl !Send for World
impl !Sync for World
impl Unpin for World
impl UnwindSafe for World
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