utils-results

The easiest and most intuitive error handling solution.

Crates.io MIT licensed

| Docs |

Overview

First, You should make your own an error set. rust err! { BrokenHeader => "broken header." AnotherHeader => "not matched header." FileNotFound => "file not found." EmptyArgument => "empty argument." UnexpectedEof => "unexpected eof." OutOfBounds => "index out of bounds." NotMatched => "btw not matched." } And just errbang! rust errbang!(err:BrokenHeader)

More Examples

```rust fn foo() -> Result { // Our Master Result Type let bar = 2; match bar { 0 => Ok(true), 1 => Ok(false), _ => errbang!(err::NotMatched, "{} is {}", "bar", bar), } }

fn main() -> Result<()> { let isbar_zero = foo()?; } rust errbang!(err::MyError1); errbang!(err::MyError2, "cannot find."); errbang!(err::MyError3, "{} is {}", "bar", 2); ```