Struct bevy_async_ecs::AsyncWorld 
source · pub struct AsyncWorld(/* private fields */);Expand description
Exposes asynchronous access to the Bevy ECS World.
Commands
Apply any Command asynchronously with AsyncWorld::apply_command.
Systems
Just like their synchronous variants, asynchronous Systems must be registered
before they can be used. Systems can optionally accept and return values asynchronously
if they are registered with AsyncWorld::register_io_system.
Entities
Spawn entities with the AsyncWorld::spawn_* family.
Resources
Insert, remove, and wait for resources to exist.
Implementations§
source§impl AsyncWorld
 
impl AsyncWorld
sourcepub async fn apply_command<C: Command>(&self, command: C)
 
pub async fn apply_command<C: Command>(&self, command: C)
Applies the given Command to the world.
sourcepub async fn apply_operation(&self, operation: AsyncOperation)
 
pub async fn apply_operation(&self, operation: AsyncOperation)
Applies the given Operation to the world.
sourcepub fn sender(&self) -> OperationSender
 
pub fn sender(&self) -> OperationSender
Returns a copy of the underlying OperationSender.
sourcepub async fn register_system<M>(
    &self,
    system: impl IntoSystem<(), (), M>
) -> AsyncSystem
 
pub async fn register_system<M>( &self, system: impl IntoSystem<(), (), M> ) -> AsyncSystem
Registers a System and returns an AsyncSystem that can be used to run the system on demand.
sourcepub async fn register_io_system<I: Send + 'static, O: Send + 'static, M>(
    &self,
    system: impl IntoSystem<I, O, M>
) -> AsyncIOSystem<I, O>
 
pub async fn register_io_system<I: Send + 'static, O: Send + 'static, M>( &self, system: impl IntoSystem<I, O, M> ) -> AsyncIOSystem<I, O>
Registers a System and returns an AsyncIOSystem that can be used to run the system on demand
while supplying an input value and receiving an output value.
sourcepub fn entity(&self, id: Entity) -> AsyncEntity
 
pub fn entity(&self, id: Entity) -> AsyncEntity
Constructs an AsyncEntity for the given Entity. If the entity does not exist, any operation
performed on it will panic.
sourcepub async fn spawn_empty(&self) -> AsyncEntity
 
pub async fn spawn_empty(&self) -> AsyncEntity
Spawns a new Entity and returns an AsyncEntity that represents it, which can be used
to further manipulate the entity.
sourcepub async fn spawn_named(
    &self,
    name: impl Into<Cow<'static, str>>
) -> AsyncEntity
 
pub async fn spawn_named( &self, name: impl Into<Cow<'static, str>> ) -> AsyncEntity
Spawns a new Entity and returns an AsyncEntity that represents it, which can be used
to further manipulate the entity. This function attaches a bevy Name component with the given
value.
sourcepub async fn spawn<B: Bundle + Reflect>(&self, bundle: B) -> AsyncEntity
 
pub async fn spawn<B: Bundle + Reflect>(&self, bundle: B) -> AsyncEntity
Spawns a new Entity with the given Bundle and returns an AsyncEntity that represents it,
which can be used to further manipulate the entity.
sourcepub async fn insert_resource<R: Resource + Reflect>(&self, resource: R)
 
pub async fn insert_resource<R: Resource + Reflect>(&self, resource: R)
Inserts a new resource or updates an existing resource with the given value.
sourcepub async fn remove_resource<R: Resource + Reflect>(&self)
 
pub async fn remove_resource<R: Resource + Reflect>(&self)
Removes the resource of a given type, if it exists.
sourcepub async fn start_waiting_for_resource<R: Resource + FromReflect>(
    &self
) -> AsyncResource<R>
 
pub async fn start_waiting_for_resource<R: Resource + FromReflect>( &self ) -> AsyncResource<R>
Start waiting for the Resource of a given type. Returns an AsyncResource which can be further
waited to receive the value of the resource.
AsyncWorld::wait_for_resource().await is equivalent to
AsyncWorld::start_waiting_for_resource().await.wait().await.
sourcepub async fn wait_for_resource<R: Resource + FromReflect>(&self) -> R
 
pub async fn wait_for_resource<R: Resource + FromReflect>(&self) -> R
Wait for the Resource of a given type. Returns the value of the resource, once it exists.
AsyncWorld::wait_for_resource().await is equivalent to
AsyncWorld::start_waiting_for_resource().await.wait().await.
Trait Implementations§
source§impl Clone for AsyncWorld
 
impl Clone for AsyncWorld
source§fn clone(&self) -> AsyncWorld
 
fn clone(&self) -> AsyncWorld
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for AsyncWorld
 
impl Debug for AsyncWorld
source§impl From<OperationSender> for AsyncWorld
 
impl From<OperationSender> for AsyncWorld
source§fn from(sender: OperationSender) -> Self
 
fn from(sender: OperationSender) -> Self
source§impl FromWorld for AsyncWorld
 
impl FromWorld for AsyncWorld
source§fn from_world(world: &mut World) -> Self
 
fn from_world(world: &mut World) -> Self
Self using data from the given World.Auto Trait Implementations§
impl RefUnwindSafe for AsyncWorld
impl Send for AsyncWorld
impl Sync for AsyncWorld
impl Unpin for AsyncWorld
impl UnwindSafe for AsyncWorld
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.