1 unstable release
0.0.1 | Jul 10, 2024 |
---|
#8 in #typesafe
7KB
72 lines
vne
[!WARNING] This is just an proof of concept of a stupid idea I had. It is probably not ready for use.
Environment variables.
Usage
You can setup vne
in your main.rs
like the following:
fn main() {
// This will ensure all variables declared by a usage of `vne!` exist.
ENV.validate().unwrap();
// The rest of your code
let testing: String = vne::vne!("TESTING");
}
// It is *really* important this is in `main.rs` and at the bottom of the file!
const ENV: vne::Environment = vne::build!();
Framework integration
You can statically analyze the environment variables that exist within your project. This could be used by a framework to show warning at deploy time for example. You can read the target/vne
file and parse it with in the following format:
{time}\n
# The following repeats
{crate_name}\t{bin_name}\t{env_1}\t{env_2}\n
Inspiration
We make use of the pattern which I originally came across in macro_state.
Dependencies
~1.7–2.5MB
~55K SLoC