[][src]Macro http_types::ensure_eq

macro_rules! ensure_eq {
    ($left:expr, $right:expr, $msg:literal $(,)?) => { ... };
    ($left:expr, $right:expr, $err:expr $(,)?) => { ... };
    ($left:expr, $right:expr, $fmt:expr, $($arg:tt)*) => { ... };
}

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.