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

eq

Macro eq 

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

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

If the expressions are not 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::eq!(x as i32, 5 as i32);
pw_assert::eq!(x as i32, 5 as i32, "x should be 5");