1 stable release

1.0.0 Mar 25, 2023

#1012 in Procedural macros

Download history 56/week @ 2024-02-16 148/week @ 2024-02-23 88/week @ 2024-03-01 133/week @ 2024-03-08 208/week @ 2024-03-15 148/week @ 2024-03-22 126/week @ 2024-03-29 215/week @ 2024-04-05 191/week @ 2024-04-12 64/week @ 2024-04-19

625 downloads per month

MIT license

3KB

Needs environment variable

Skip code (such as a test) at compile time if an environment variable is undefined.

Example

some_test will not be compiled if SOMEENVIRONMENTVARIABLE is not defined:

#[needs_env_var(SOMEENVIRONMENTVARIABLE)]
#[test]
fn some_test() {
    assert!(1 == 1);
}

Note: As needs_env_var is evaluated at compile time you need to force a re-compilation an environment variable is defined after compilation, e.g. with cargo clean.

No runtime deps