Skip to main content

Module assert_fn_err_le

Module assert_fn_err_le 

Source
Expand description

Assert a function Err(…) is less than or equal to another.

Pseudocode:
(a_function(a_param) ⇒ Err(a) ⇒ a) ≤ (b_function(b_param) ⇒ Err(b) ⇒ b)

§Example

use assertables::*;
fn f(i: i8) -> Result<String, String> {
    match i {
        0..=9 => Ok(format!("{}", i)),
        _ => Err(format!("{:?} is out of range", i)),
    }
}

let a: i8 = 10;
let b: i8 = 20;
assert_fn_err_le!(f, a, f, b);

§Module macros