Struct bevy_async_ecs::AsyncEntity
source · pub struct AsyncEntity { /* private fields */ }
Expand description
Represents an Entity
that can be manipulated asynchronously.
The easiest way to get an AsyncEntity
is with AsyncWorld::spawn_empty()
.
Dropping the AsyncEntity
WILL NOT despawn the corresponding entity in the synchronous world.
Use AsyncEntity::despawn
to despawn an entity asynchronously.
Implementations§
source§impl AsyncEntity
impl AsyncEntity
sourcepub fn sender(&self) -> CommandQueueSender
pub fn sender(&self) -> CommandQueueSender
Returns a copy of the underlying CommandQueueSender
.
sourcepub async fn insert<B: Bundle>(&self, bundle: B)
pub async fn insert<B: Bundle>(&self, bundle: B)
Adds a Bundle
of components to the entity. This will overwrite any previous value(s) of
the same component type.
sourcepub async fn start_waiting_for<C: Component + Clone>(&self) -> AsyncComponent<C>
pub async fn start_waiting_for<C: Component + Clone>(&self) -> AsyncComponent<C>
Start waiting for the Component
of a given type. Returns an AsyncComponent
which can be further
waited to receive the value of the component.
AsyncComponent::wait_for().await
is equivalent to
AsyncComponent::start_waiting_for().await.wait().await
.
sourcepub async fn wait_for<C: Component + Clone>(&self) -> C
pub async fn wait_for<C: Component + Clone>(&self) -> C
Wait for the Component
of a given type. Returns the value of the component, once it exists
on the represented entity.
AsyncComponent::wait_for().await
is equivalent to
AsyncComponent::start_waiting_for().await.wait().await
.
sourcepub async fn insert_wait_remove<I: Component, WR: Component + Clone>(
&self,
component: I
) -> WR
pub async fn insert_wait_remove<I: Component, WR: Component + Clone>( &self, component: I ) -> WR
Insert the given Component
of type I
onto the entity, then immediately wait for a
component of type WR
to be added to the entity. After one is received, this will then
remove the component of type WR
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for AsyncEntity
impl Send for AsyncEntity
impl Sync for AsyncEntity
impl Unpin for AsyncEntity
impl UnwindSafe for AsyncEntity
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.