[−][src]Crate postfix_macros
Postfix macros on stable Rust, today.
postfix_macros! { "hello world".println!(); 42.assert_ne!(4 + 2); val.iter() .map(|v| v.1) .find(|z| z.matches!(Custom::Enum(_) | Custom::EnumOther)) .dbg!() .unwrap_or!{ return }; }
The crate provides the postfix_macros!
macro,
as well as some helpful macros for use in a postfix context,
for your greatest convenience.
Rust construct | postfix replacement macro |
---|---|
unwrap_or , unwrap_or_else | unwrap_or! |
if let with else clause | match_or! |
match with default case | match_or! |
if <bool> , bool::then | then! |
else | then_else! |
Macros
match_or |
|
postfix_macros | Proc macro to parse code containing postfix macros, to rewrite it to use traditional macro invocations. |
then | Executes the body if the argument is |
then_else |
|
unwrap_or | Either unwraps the content passed to the macro, or executes the passed code block. |