5 releases (1 stable)
1.0.0 | Dec 22, 2023 |
---|---|
0.2.0 | Sep 22, 2023 |
0.1.3 | Sep 3, 2023 |
#245 in Procedural macros
255 downloads per month
Used in 6 crates
(via termal_core)
19KB
Place-macro
Macros you wish you had while you were writing your non-proc macro.
This library privides some macros that make writing regural non-proc macros much simpler, readable and with less dirty tricks.
The main macro of this library is place
. It is able to expand the
macros in this library in reverse expansion order.
If you have some macros that you would like to add feel free to open new issue on GitHub.
How to get it
With cargo
cargo add place_macro
In Cargo.toml
[dependencies]
place_macro = "1.0.0"
Macros
place
: expands the following macros in reverse order, see docs for more info
ignore
: expands to nothingidentity
: expands to what is given, it bypasses the reverse order in theplace
macrodollar
: expands to dollar sign$
string
: concats the contents into single string, see the docidentifier
: concats the contents into sintle identifier in the same way as stringhead
: expands to the first tokentail
: expands to all but the first tokenstart
: expands to all but the last tokenlast
: expands to the last tokenreverse
: expands to the tokens in reverse orderstringify
: expands to string of the inputreplace_newline
: replaces all newlines and folowing whitespace in literal with the given literalstr_replace
: replace in string literalto_case
: change the case of a identifier
Examples
For examples and more detailed info about how to use the macros in this crate see docs
Links
- Author: BonnyAD9
- GitHub repository: BonnyAD/place_macro
- Package: crates.io
- Documentation: docs.rs
- My Website: bonnyad9.github.io
Dependencies
~680KB
~10K SLoC