Expand description
Parse and load .env files.
EnvLoader::load is the safe default and returns a process-isolated
in-memory map.
Convenience loaders (dotenv, from_path, from_paths, from_filename)
mutate the process environment and are unsafe, because callers must
guarantee no concurrent process-environment access.
The load attribute macro offers startup-loading ergonomics for
Result-returning functions. fn main stays safe; other annotated
functions become unsafe fn so process-env mutation keeps its safety
contract.
Structs§
- Entry
- A parsed
KEY=VALUEentry from a.envfile or input buffer. - EnvLoader
- Builder-style dotenv loader.
- Load
Report - Summary of the load operation.
- Loaded
Env - Result of a safe in-memory load.
- Parse
Error - Target
Env - Destination for loaded environment variables.
Enums§
- Encoding
- Encoding choice for input data.
- Error
- KeyParsing
Mode - Key validation behavior for parser and loader entry parsing.
- Parse
Error Kind - Substitution
Mode - Variable expansion behavior for loader values.
Functions§
- dotenv⚠
- Load
.envfrom the current working directory into the process environment. - from_
filename ⚠ - Load a dotenv file by filename into the process environment.
- from_
path ⚠ - Load a
.envfile from a specific path into the process environment. - from_
paths ⚠ - Load multiple
.envfiles into the process environment. - parse_
bytes - Parse dotenv entries from UTF-8 bytes.
- parse_
bytes_ with_ mode - Parse dotenv entries from UTF-8 bytes using a specific key parsing mode.
- parse_
reader - Parse dotenv entries from a buffered reader.
- parse_
reader_ with_ mode - Parse dotenv entries from a buffered reader using a specific key parsing mode.
- parse_
str - Parse dotenv entries from UTF-8 text.
- parse_
str_ with_ mode - Parse dotenv entries from UTF-8 text using a specific key parsing mode.
Attribute Macros§
- load
- Load
.enventries into the process environment before running a function.