fuchsia_async

Attribute Macro run_until_stalled

#[run_until_stalled]
Expand description

Define an async function that should complete without stalling.

If the async function should stall then a panic will be raised. For example:

#[fuchsia_async::run_until_stalled]
async fn this_will_fail_and_not_block() -> Result<(), anyhow::Error> {
    let () = future::empty().await;
    Ok(())
}

will cause an immediate panic instead of hanging.

This is mainly intended for testing, and takes an optional test argument.

#[fuchsia_async::run_until_stalled(test)]
async fn test_foo() {}