[−][src]Macro dynerr::dynerr
A macro for returning custom errors as DynError.
Example
fn example(x: u32) -> DynResult<u32> { match x { 1 => Ok(x), //Ok 2..=4 => dynerr!(ExampleError1::ThisError(x)), //custom error 5..=10 => dynerr!(ExampleError2::ThatError(x)), //different custom error _ => { std::fs::File::open("none")?; //an error not even defined by you! Ok(x) } } }