Crate postfix_macros

Source
Expand description

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 constructpostfix replacement macro
unwrap_or, unwrap_or_elseunwrap_or!
if let with else clausematch_or!
match with default casematch_or!
if <bool>, bool::thenthen!
elsethen_else!

Macrosยง

match_or
match macro with a default case shorthand
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 true
then_else
else clauses for the then! macro
unwrap_or
Either unwraps the content passed to the macro, or executes the passed code block.