macro_rules! err_downcast {
    ( $err:expr ) => { ... };
    ( $err:expr, $($v:ident : $ty:ty => $action:expr),* , ) => { ... };
    ( $err:expr, $v:ident : $ty:ty => $action:expr $(, $rv:ident : $rty:ty => $raction:expr)* ) => { ... };
}
Expand description

Downcast matching.

Usage:

let res = err_downcast! {
   err,
   ty: Type => { /* use ty as Type */ },
   yours: YourType => { /* use yours as YourType */ },
};

Where err is a anyhow::Error. When one of the type arms match, then it returns Ok(value from expr), otherwise Err(err). It’s like downcast but for multiple types.