#[trace_async]Expand description
Rewrites an async function body so every .await records a labeled
async_reify::PollEvent into the named shared trace.
The macro takes a single mandatory argument: trace = IDENT, where
IDENT names a value of type
std::sync::Arc<std::sync::Mutex<async_reify::Trace>> that is in
scope inside the function. Typically IDENT is a function parameter.
Each .await inside the function body is replaced with an
async_reify::LabeledFuture that records into the shared trace.
The label is "<expr> @ <file>:<line>". Awaits inside nested
closures or nested item definitions are left alone (they belong
to a different async scope).
§Examples
ⓘ
use std::sync::{Arc, Mutex};
use async_reify::Trace;
use async_reify_macros::trace_async;
#[trace_async(trace = trace)]
async fn workflow(trace: Arc<Mutex<Trace>>) -> i32 {
fetch().await;
compute().await;
42
}