Macro microbit::await []

macro_rules! await {
    ( $ e : expr ) => { ... };
}

Await operation (won't work until the language gains support for generators)

This macro evaluates the expression $e cooperatively yielding control back to the (generator) caller whenever $e evaluates to Error::WouldBlock.

Requirements

This macro must be called within a generator body.

Input

An expression $e that evaluates to nb::Result<T, E>

Output

  • Ok(t) if $e evaluates to Ok(t)
  • Err(e) if $e evaluates to Err(nb::Error::Other(e))