Macro assertables::assure_fn_lt [−][src]
macro_rules! assure_fn_lt { ($function:path, $left:expr, $right:expr $(,)?) => { ... }; ($function:path, $left:expr, $right:expr, $($arg:tt)+) => { ... }; }
Expand description
Assure one function output is less than to another function output.
-
When true, return
Ok(true). -
When false, return
Ok(false). -
Otherwise, return
Errwith a message and the values of the expressions with their debug representations.
Examples
let x: Result<bool, &str> = assure_fn_lt!(i32::abs, 1 as i32, -2 as i32); //-> Ok(true)
let x: Result<bool, &str> = assure_fn_lt!(i32::abs, -2 as i32, 1 as i32); //-> Ok(false)
This macro has a second form where a custom message can be provided.