[−][src]Macro matux::expect
Asserts that an expression follows a pattern; otherwise fail with an error message.
Example
#[derive(Debug)] enum A { B(&'static str), C(u32), } let c = A::C(3); let inner = matux::expect!(c, A::C(x) => x, "c is not A::C but {:?}", c); assert_eq!(inner, 3u32);
#[derive(Debug)] enum A { B(&'static str), C(u32), } let c = A::C(3); matux::expect!(c, A::B(x) => x, "c is not A::B but {:?}", c); // Panic: "c is not A::B but C(3)"