Macro bevy_defer::async_system
source · macro_rules! async_system { (|$($field: ident : $ty: ty),* $(,)?| $body: expr) => { ... }; }
Expand description
Construct an async system via the AsyncEntityParam
abstraction.
§Syntax
- Expects an async closure with
AsyncEntityParam
s as parameters and returns()
. ?
can be used to propagateAccessError
s.- Most of this crate’s
AsyncEntityParam
s, likeSender
,Receiver
andAsyncComponent
are automatically imported and may shadow external names.
§Example
// Set scale based on received position
let system = async_system!(|recv: Receiver<PositionChanged>, transform: AsyncComponent<Transform>|{
let pos: Vec3 = recv.recv().await;
transform.set(|transform| transform.scale = pos).await?;
})