Macro assert_cancel_safe_async

Source
macro_rules! assert_cancel_safe_async {
    ($make_future:expr, $expected:expr, $on_pending:expr) => { ... };
}
Expand description

Async convenience macro for assert_cancel_safe_async.

Example:

assert_cancel_safe_async!(
    two_sleeps(),
    7,
    || async { tokio::time::advance(std::time::Duration::from_millis(1)).await }
);
  • my_future_expr is any expression that produces a fresh future when evaluated (e.g. two_sleeps()).
  • expected_value is the value you expect the future to resolve to. Pass a plain value, not a reference. The macro will take a reference internally.
  • on_pending is a closure that returns an async block, used to drive external progress each time the future yields Poll::Pending.