5 releases
0.2.0-rc1 |
|
---|---|
0.1.2 | Jun 26, 2023 |
0.1.1 | Jun 25, 2023 |
0.1.0 |
|
0.0.0 | Jun 25, 2023 |
#195 in Procedural macros
116,024 downloads per month
Used in 188 crates
(9 directly)
16KB
116 lines
::cfg_eval
#[cfg_eval]
in stable Rust.
Example
use ::macro_rules_attribute::apply;
#[macro_use]
extern crate cfg_eval;
fn main()
{
let output_without_cfg_eval = {
#[apply(stringify!)]
enum Foo {
Bar,
#[cfg(FALSE)]
NonExisting,
}
};
// This is usually not great.
assert!(output_without_cfg_eval.contains("NonExisting"));
let output_with_cfg_eval = {
#[cfg_eval]
#[apply(stringify!)]
enum Foo {
Bar,
#[cfg(FALSE)]
NonExisting,
}
};
assert_eq!(output_with_cfg_eval, stringify! {
enum Foo {
Bar,
}
});
}
Dependencies
~215–650KB
~15K SLoC