assertables

Macro assert_some_ne

source
macro_rules! assert_some_ne {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert two expressions are Some(_) and their values are not equal.

Pseudocode:
(a ⇒ Some(a̅) ⇒ a̅) ≠ (b ⇒ Some(b̅) ⇒ b̅)

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;

let a: Option<i8> = Option::Some(1);
let b: Option<i8> = Option::Some(2);
assert_some_ne!(a, b);

let a: Option<i8> = Option::Some(1);
let b: Option<i8> = Option::Some(1);
assert_some_ne!(a, b);
// assertion failed: `assert_some_ne!(a, b)`
// https://docs.rs/assertables/8.13.0/assertables/macro.assert_some_ne.html
//  a label: `a`,
//  a debug: `Some(1)`,
//  b label: `b`,
//  b debug: `Some(1)`,
//  a inner: `1`,
//  b inner: `1`

§Module macros