#env-var #variables #env #environment #proc-macro #string-literal #compile-time

macro format_env

Substitutes environment variables into a string literal at compile time

2 stable releases

1.0.1 Nov 13, 2020

#580 in Configuration

37 downloads per month

MIT license

8KB
164 lines

Substitues environment variables into a string literal at compile time.

Example:

use format_env::format_env;
assert_eq!(format_env!("Name: $(CARGO_PKG_NAME), License: $(CARGO_PKG_LICENSE)"), "Name: format_env, License: MIT")
assert_eq!(format_env!("Name: $$(CARGO_PKG_NAME)"), "Name: $(CARGO_PKG_NAME)")

Dependencies

~61KB