Purpose
This tilde crate utilizes the disused tilde operator ~ to generate
syntatic sugar for Rust program.
Features
- Postfix macro. The syntax is
first_arg.~the_macro!(rest_args), which will be desugared asthe_macro!( first_arg, rest_args ). As proposed in simple postfix macros #2442,first_argwill be evaluated excactly once.
Example: Postfix macro
Suppose i: i32, The library user could write: i.~inc!(),
i.clone().~inc!() etc, which is a sugar as inc!( i ) and
inc!( i.clone() ).
This feature is in compliance with RFC 2442:
tilde!
- Postfix function. The syntax is
first_arg.~the_fn(rest_args), which will be desugared asthe_fn!( first_arg, rest_args ).
Example: Postfix function
Suppose i: i32, The library user could write: i.~inc(),
i.clone().~inc() etc, which is a sugar as inc( i ) and
inc( i.clone() ).
More features will be added in the future.
License
Licensed under MIT.