Skip to main content Skip to main content
Pigweed's logo Pigweed
  1. Home
  2. Reference
  3. Rust
  4. pw_assert
  5. ne

ne

Macro ne 

Source
macro_rules! ne {
    ($lhs:expr, $rhs:expr $(,)?) => { ... };
    ($lhs:expr, $rhs:expr, $($args:expr),* $(,)?) => { ... };
}
Expand description

Asserts that two expressions are not equal (equivalent to assert_ne!).

If the expressions are equal, this macro delegates to the backend macro assert_binary_backend!.

Note that depending on the backend, both expressions may need to be cast expressions (e.g., x as i32).

§Examples

let x = 5;
pw_assert::ne!(x as i32, 6 as i32);
pw_assert::ne!(x as i32, 6 as i32, "x should not be 6");