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

macro format_env

Substitutes environment variables into a string literal at compile time

2 stable releases

1.0.1 Nov 13, 2020

#749 in Configuration

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

~56KB