Macro toad::exec_inner_step

source ·
macro_rules! exec_inner_step {
    ($result:expr, $err:expr) => { ... };
    (run_anyway_when_would_block = $run_anyway_when_would_block:expr, $result:expr, $err:expr) => { ... };
}
Expand description

Macro to execute inner steps, converting the Option<nb::Result<T, E>> to Option<T> by returning the inner step’s Errors & WouldBlock

match $result {
  | None => None,
  | Some(Ok(t)) => Some(t),
  | Some(Err(nb::Error::WouldBlock)) if $run_anyway_when_would_block => None,
  | Some(Err(nb::Error::WouldBlock)) => return Some(Err(nb::Error::WouldBlock)),
  | Some(Err(nb::Error::Other(e))) => return Some(Err(nb::Error::Other($err(e)))),
}