de_env-1.0.0-beta.2 has been yanked.
🦀 de_env
Deserialize environment variables through serde.
You may be looking for:
Example
Assuming we have a LOG and PORT environment variable:
let config: Config = from_env.unwrap;
println!;
Boolean parsing
Boolean parsing is case-insensitive.
If the truthy-falsy feature is enabled (default):
- Truthy values:
trueor its shorthandtyesor its shorthandyon1
- Falsy values:
falseor its shorthandfnoor its shorthandnoff0
If the truthy-falsy feature is disabled, only true and false are
considered valid booleans.
Enum
Only unit variants can be deserialized.
Assuming we have a LEVEL environment variable set to HIGH, MEDIUM or
LOW:
let pool: Pool = from_env.unwrap;
println!;
Unsupported types
- Nested structs
- Nested enums
- Nested Maps
- Non-unit enum variants
- Tuples
- Sequences
- Byte Arrays