macro_rules! task {
($pool_type:path, $block:expr) => { ... };
($pool_type:path, $event:expr, $block:expr) => { ... };
(@inner $pool_type:path, $block:expr $(, $event:expr)?) => { ... };
}Expand description
Creates an asychronously executing task. When finished, may optionally send an event.
Example usage:
let task = task!(
IoTaskPool,
MyEvent::default(), // (optional)
async move |q: &mut CommandQueue| {
// do some async stuff
q.push(|world: &mut World| {
// do some world mutation
});
});
task(world);