8 releases (5 breaking)
0.6.1 | Sep 2, 2023 |
---|---|
0.6.0 | Aug 29, 2023 |
0.5.0 | Aug 23, 2023 |
0.4.0 | Aug 20, 2023 |
0.1.0 | May 7, 2023 |
#1386 in Procedural macros
968 downloads per month
Used in 11 crates
(via devela)
19KB
239 lines
devela_macros
Procedural macros for devela
.
See the documentation for more information.
Status
This is currently in an experimental stage of development.
License
This project is dual licensed under either MIT or Apache-2.0 at your option.
Contributing
Contributions are welcomed to help refine and improve this library over time. If you notice a bug, have an idea for a new feature, or simply want to suggest improvements to the existing codebase, please get in touch.
lib.rs
:
Conditional compilation
Each form of conditional compilation takes a compilation predicate that
evaluates to true
or false
.
These are the [#[compile]
][compile()] and [#[compile_attr]
][compile_attr()]
attributes and the [cif!
][cif()] macro.
They are similar to the #[cfg]
and #[cfg_attr]
attributes and
the cfg!
macro, except they use compilation predicates.
Compilation predicates
The following compilation predicates are supported:
-
unary:
- A bare predicate returns
true
only if it is thetrue
literal not()
: returnstrue
only if the predicate does not evaluate totrue
.
- A bare predicate returns
-
binary:
eq()
: returnstrue
if both predicates are evaluated as equal.ne()
: returnstrue
if both predicates are not evaluated as equal.xor()
: returnstrue
if only one predicate istrue
, but not both.ge()
: returnstrue
if both predicates are numbers and the first >= the second.gt()
: returnstrue
if both predicates are numbers and the first > the second.le()
: returnstrue
if both predicates are numbers and the first <= the second.lt()
: returnstrue
if both predicates are numbers and the first < the second.
-
non-binary:
any()
: returnstrue
if any predicate istrue
.all()
: returnstrue
if all predicates aretrue
.none()
: returnstrue
if there is no given predicate.some()
: returnstrue
if there is some given predicate.diff()
: returnstrue
if any predicate has a different text.same()
: returnstrue
if all the predicates have the same text.xany()
: returnstrue
if there are anytrue
predicates, but not all.xodd()
: returnstrue
if there is an odd number oftrue
predicates.xone()
: returnstrue
if there is just onetrue
predicate, but no more.
When more than 1 predicate is supported, they are separated by commas.