Function std::assert::assert_ne

pub fn assert_ne<T>(v1: T, v2: T)
where
    T: Eq,
Expand description

Asserts that the given values v1 & v2 will never be equal during runtime.

Arguments

  • v1: [T] - The first value to compare.
  • v2: [T] - The second value to compare.

Reverts

  • Reverts when v1 == v2.

Examples

fn foo(a: u64, b: u64) {
    assert_ne(a, b);
    // if code execution continues, that means `a` is not equal to `b`
    log("a is not equal to b");
}