2 releases
0.1.1 | Jun 21, 2019 |
---|---|
0.1.0 | Jun 21, 2019 |
#53 in #default-value
10,933 downloads per month
Used in 12 crates
(5 directly)
3KB
default-env
default_env!
is a macro like env!
that returns a default value if the environment variable is not found.
Unlike option_env!
, the output of default_env!
can be used in macros (because who doesn't love macros in their macros?).
Example
macro_rules! long_str {
() => {
concat!(
"Hello, ", default_env!("USER", "anonymous user"), ".",
"Today is ", default_env!("WEEKDAY", compile_error!("You exist in a land beyond time."))
)
}
}
Dependencies
~2MB
~46K SLoC