[−][src]Macro postfix_macros::match_or
match
macro with a default case shorthand
Meant to be used in a postfix context, as
the postfix analog of match
and if let
Rust constructs.
#[derive(Copy, Clone)] enum Foo { Bar(u8), Baz, } let v = Foo::Bar(42); let mut w = 0; for i in 0..3 { w += i; v.match_or!{ Foo::Bar(x) => x; break }; } assert_eq!(w, 3);