envopt 0.0.0

Parse environment variables by defining a struct.
Documentation
  • Coverage
  • 54.55%
    6 out of 11 items documented1 out of 8 items with examples
  • Size
  • Source code size: 6.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.18 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • zoranzaric/envopt
    24 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zoranzaric

envopt

Crates.io Documentation License

Parse environment variables by defining a struct.

Example

use envopt::EnvOpt;

#[derive(EnvOpt)]
pub enum EnvOpts {
    #[envopt(name = "FOO")]
    Foo,
    #[envopt(name = "BAR", default = "default-bar")]
    Bar,
}

pub fn main() {
    EnvOpts::validate_or_exit();

    println!("FOO: {}", EnvOpts::Foo.value_or_exit());
    println!("BAR: {}", EnvOpts::Bar.value_or_exit());
}