adotenv-process
Explicit process-environment mutation for
adotenv loaded environments.
use load_cascade;
use apply;
let loaded = load_cascade?;
// The caller must guarantee no concurrent process-environment access.
unsafe ;
apply takes a LoadedEnvironment from the adotenv load feature. It
validates every key and value before the first mutation and returns an
ApplyError for an empty key, a key that contains NUL or =, or a value that
contains NUL. It sets only keys from the loaded environment, removes nothing and
cannot roll changes back. The process environment is global, so the caller owns
the concurrency guarantee.
validate runs the same checks without changing anything.
Prefer passing LoadedEnvironment::values() to a child process, or reading them
directly, when mutation is not required. See the
process environment guide.
This is the only workspace crate with an unsafe API. The core adotenv crate
forbids unsafe code. The crate needs Rust 1.81 or later.