macro_rules! ensure_eq {
($left:expr, $right:expr, $msg:literal $(,)?) => { ... };
($left:expr, $right:expr, $msg:expr $(,)?) => { ... };
($left:expr, $right:expr, $msg:expr, $($arg:tt)*) => { ... };
}Expand description
Return early with an error if two expressions are not equal to each other.
This macro is equivalent to if $left != $right { return Err(From::from($err)); }.
Analogously to assert_eq!, ensure_eq! takes two expressions and exits the function
if the expressions are not equal. Unlike assert_eq!, ensure_eq! returns an Error
rather than panicking.