Macro assertables::assure_fn_err_string_ge [−][src]
macro_rules! assure_fn_err_string_ge { ($function:path, $left:expr, $right:expr $(,)?) => { ... }; ($function:path, $left:expr, $right:expr, $($arg:tt)+) => { ... }; }
Expand description
Assure one function ok() is greater than or equal to another function ok().
-
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
fn f(i: i32) -> Result<bool, String> { Err(format!("{:?}", i)) } let x: Result<bool, String> = assure_fn_err_string_ge!(f, 2, 1); //-> Ok(true)
fn f(i: i32) -> Result<bool, String> { Err(format!("{:?}", i)) } let x: Result<bool, String> = assure_fn_err_string_ge!(f, 1, 2); //-> Ok(false)
This macro has a second form where a custom message can be provided.