pub struct Entity { /* private fields */ }Expand description
Associates a discrete group of components within the world.
Entity can be used to add and remove components lazily.
Implementations
sourceimpl Entity
impl Entity
pub fn id(&self) -> usize
sourcepub fn with_bundle<B: IsBundle + Send + Sync + 'static>(self, bundle: B) -> Self
pub fn with_bundle<B: IsBundle + Send + Sync + 'static>(self, bundle: B) -> Self
Lazily add a component bundle to archetype storage.
This entity will have the associated components after the next tick.
sourcepub fn insert_bundle<B: IsBundle + Send + Sync + 'static>(&mut self, bundle: B)
pub fn insert_bundle<B: IsBundle + Send + Sync + 'static>(&mut self, bundle: B)
Lazily add a component bundle to archetype storage.
This entity will have the associated components after the next tick.
sourcepub fn insert_component<T: Send + Sync + 'static>(&mut self, component: T)
pub fn insert_component<T: Send + Sync + 'static>(&mut self, component: T)
Lazily add a component bundle to archetype storage.
This entity will have the associated component after the next tick.
sourcepub fn remove_component<T: Send + Sync + 'static>(&mut self)
pub fn remove_component<T: Send + Sync + 'static>(&mut self)
Lazily remove a component bundle to archetype storage.
This entity will have lost the associated component after the next tick.
Methods from Deref<Target = usize>
Trait Implementations
sourceimpl Clone for Entity
impl Clone for Entity
You may clone entities, but each one does its own lazy updates, separate from all other clones.
Auto Trait Implementations
impl !RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl !UnwindSafe for Entity
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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