| Crates.io | default-env |
| lib.rs | default-env |
| version | 0.1.1 |
| created_at | 2019-06-21 02:31:41.604633+00 |
| updated_at | 2019-06-21 02:46:18.477659+00 |
| description | The `env!` macro but with a default value. |
| homepage | |
| repository | https://github.com/nhynes/default-env |
| max_upload_size | |
| id | 142495 |
| size | 4,534 |
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?).
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."))
)
}
}