macro_rules! assert_same {
($left:expr, $right:expr $(,)?) => { ... };
($left:expr, $right:expr, $($arg:tt)+) => { ... };
}Expand description
Asserts that two values are structurally the same.
This macro does not require PartialEq - it uses Facet reflection to
compare values structurally. Two values are “same” if they have the same
structure and the same field values, even if they have different type names.
§Panics
Panics if the values are not structurally same, displaying a colored diff showing exactly what differs.
Also panics if either value contains an opaque type that cannot be inspected.
§Example
use facet::Facet;
use facet_assert::assert_same;
#[derive(Facet)]
struct Person {
name: String,
age: u32,
}
let a = Person { name: "Alice".into(), age: 30 };
let b = Person { name: "Alice".into(), age: 30 };
assert_same!(a, b);