envoke
Envoke is a simple and ergonomic way to load environment variables into struct fields with minimal setup. With support for multiple ways to define environment variables with additional fallbacks, default values, custom parsing, validation, and nested structs for a cleaner interface.
Designed to be flexible and reduce boilerplate, all to make it easier to manage environment variables in your application.
Whats new?
- This list!
- Load environment variables from a
.envfile with thedotenvattribute—works on both structs and enums. - The new
try_parse_fnattribute lets you use fallible parsing functions. Just likeparse_fn, but it accepts aResult.
Read more here!
Useful links
Key features
-
Flexible Environment Variable Naming
Customize naming conventions with support for multiple environments, renaming, prefixes, and suffixes. -
Versatile Default Values
Define defaults through type-based values, direct assignments, or function return values. -
Pre-Assignment Parsing
Convert values into complex types before field assignment for enhanced data handling. -
Comprehensive Validation
Validate values before and/or after assignment to ensure data integrity. -
Structured Data Support
Seamlessly work with nested structs, enums, or standalone enums. -
Built-in Sequence & Map Parsing
Effortlessly parse sequence and map-formatted strings for structured data.
Usage
Add to your Cargo.toml
[]
= "0.3.0"
Example
use Duration;
use Context;
use ;