Macro assertables::assertable_io_ge
source · [−]macro_rules! assertable_io_ge {
($left:expr, $right:expr $(,)?) => { ... };
($left:expr, $right:expr, $($arg:tt)+) => { ... };
}Expand description
Assert one value is greater than or equal to another value.
-
When true, return
Ok(()). -
Otherwise, return
Errwith a message and the values of the expressions with their debug representations.
Examples
let x = assertable_io_ge!(2, 1);
//-> Ok(())
assert_eq!(x.unwrap(), ());
let x = assertable_io_ge!(1, 2); //-> Err(std::io::Error::new(std::io::ErrorKind::InvalidInput, "…");
//-> Err(std::io::Error::new(std::io::ErrorKind::InvalidInput, "…")
// assertable failed: `assertable_io_ge!(left, right)`
// left: `1`,
// right: `2`
assert_eq!(
x.unwrap_err().get_ref().unwrap().to_string(),
"assertable failed: `assertable_io_ge!(left, right)`\n left: `1`,\n right: `2`"
);This macro has a second form where a custom message can be provided.