fehler 1.0.0

A library for error-handling syntax in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use fehler::*;

#[throws(as Option)]
fn foo(x: bool) -> i32 {
    if x { throw!(); }
    0
}

#[test]
fn test_outcome_true() {
    assert!(foo(true).is_none())
}

#[test]
fn test_outcome_false() {
    assert_eq!(Some(0), foo(false))
}