Expand description
§use-env-var
Environment variable primitives for RustUse CLI-adjacent code.
This crate validates environment variable names and wraps safe reads from std::env. It does not provide a global configuration system, cache, mutation API, or process-wide runtime.
§Example
use use_env_var::{EnvVarName, is_valid_env_var_name};
let name = EnvVarName::new("RUST_LOG")?;
assert_eq!(name.as_str(), "RUST_LOG");
assert!(is_valid_env_var_name("RUST_LOG"));§Scope
Use this crate when a library needs stable env var vocabulary without owning configuration policy.
Modules§
- prelude
- Commonly used environment variable primitives.
Structs§
- EnvVar
Name - An owned, validated environment variable name.
- EnvVar
Value - An owned environment variable value.
- Typed
EnvVar - A typed environment variable wrapper with caller-provided parsing.
Enums§
- EnvVar
Name Error - Validation errors for environment variable names.
- EnvVar
Read Error - Errors returned while reading environment variables.
- Typed
EnvVar Error - Errors returned while reading a typed environment variable.
Functions§
- is_
valid_ env_ var_ name - Returns whether
nameis valid for this crate’s environment variable primitive. - read_
env_ var - Reads a present Unicode environment variable.
- read_
optional_ env_ var - Reads an optional Unicode environment variable.