pub struct World { /* private fields */ }
Expand description
World is the core of XECS.It manages all components and entities
Implementations
sourceimpl World
impl World
sourcepub fn register_resource<R: Resource>(&mut self, resource: R)
pub fn register_resource<R: Resource>(&mut self, resource: R)
Register resource in world
sourcepub fn resource_read<R: Resource>(&self) -> Option<ResourceRead<'_, R>>
pub fn resource_read<R: Resource>(&self) -> Option<ResourceRead<'_, R>>
Get a read guard of resource
sourcepub fn resource_write<R: Resource>(&self) -> Option<ResourceWrite<'_, R>>
pub fn resource_write<R: Resource>(&self) -> Option<ResourceWrite<'_, R>>
Get a write guard of resource
sourcepub fn has_registered<T: Component>(&self) -> bool
pub fn has_registered<T: Component>(&self) -> bool
Check if component is registered.
sourcepub fn create_entity(&self) -> Entity<'_>
pub fn create_entity(&self) -> Entity<'_>
Create an entity without any component in World, return an Entity.
sourcepub fn create_entities(&self, count: usize) -> Entities<'_>
pub fn create_entities(&self, count: usize) -> Entities<'_>
sourcepub fn remove_entity(&self, entity_id: EntityId)
pub fn remove_entity(&self, entity_id: EntityId)
Remove entity and its components.
sourcepub fn attach_component<T: Component>(&self, entity_id: EntityId, component: T)
pub fn attach_component<T: Component>(&self, entity_id: EntityId, component: T)
sourcepub fn detach_component<T: Component>(&self, entity_id: EntityId) -> Option<T>
pub fn detach_component<T: Component>(&self, entity_id: EntityId) -> Option<T>
sourcepub fn components_read<T: Component>(&self) -> Option<StorageRead<'_, T>>
pub fn components_read<T: Component>(&self) -> Option<StorageRead<'_, T>>
Get the component storage’s read guard
sourcepub fn components_write<T: Component>(&self) -> Option<StorageWrite<'_, T>>
pub fn components_write<T: Component>(&self) -> Option<StorageWrite<'_, T>>
Get the component storage’s write guard
sourcepub fn entity_component_read<T: Component>(
&self,
id: EntityId
) -> Option<ComponentRead<'_, T>>
pub fn entity_component_read<T: Component>(
&self,
id: EntityId
) -> Option<ComponentRead<'_, T>>
Get the read guard of component of an entity
sourcepub fn entity_component_write<T: Component>(
&self,
id: EntityId
) -> Option<ComponentWrite<'_, T>>
pub fn entity_component_write<T: Component>(
&self,
id: EntityId
) -> Option<ComponentWrite<'_, T>>
Get the write guard of component of an entity
sourcepub fn make_group<G: Into<Group> + 'static + Copy>(&mut self, group: G)
pub fn make_group<G: Into<Group> + 'static + Copy>(&mut self, group: G)
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl !UnwindSafe for World
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more