Skip to main content

Crate use_env_var

Crate use_env_var 

Source
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§

EnvVarName
An owned, validated environment variable name.
EnvVarValue
An owned environment variable value.
TypedEnvVar
A typed environment variable wrapper with caller-provided parsing.

Enums§

EnvVarNameError
Validation errors for environment variable names.
EnvVarReadError
Errors returned while reading environment variables.
TypedEnvVarError
Errors returned while reading a typed environment variable.

Functions§

is_valid_env_var_name
Returns whether name is 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.