# adotenv
> Literal, lossless .env parser and verified source-preserving editing library for Rust.
- Crate version: `adotenv 1.8.1`
- MSRV: Rust 1.81 (`no_std` + `alloc` core available via `default-features = false`)
- Safety: `#![forbid(unsafe_code)]` unconditional, zero required runtime dependencies
- License: MIT OR Apache-2.0
- Repository: https://github.com/zeropier/adotenv
- Crates: https://crates.io/crates/adotenv
- Rustdoc API: https://docs.rs/adotenv
- Benchmarks (v1.8.0, commit 28ffe7b): 3.83x faster geomean, 2.83x lower peak heap, and 610x fewer allocations than `dotenvy` (https://zeropier.com/adotenv/benchmarks/)
## Documentation pages
- [Introduction](https://zeropier.com/adotenv/docs/):
Rust library and command-line tool
Read and edit .env files...
### Start here
- [Getting started](https://zeropier.com/adotenv/docs/guide/getting-started/): adotenv reads .env files as source code: it keeps every byte, reports where each token is and changes text only through verified edits. This page installs...
- [Parsing and lookup](https://zeropier.com/adotenv/docs/guide/parsing/): A Document holds one source string and the items a dialect reads from it. It never changes the source: printing a document returns the original bytes.
- [Dialects](https://zeropier.com/adotenv/docs/design/dialects/): There is no single .env standard. Tools disagree about comments, quotes, escapes, duplicate keys and keys without values. adotenv makes the reading rules...
### Guide
- [Editing](https://zeropier.com/adotenv/docs/guide/editing/): Edits work on one parsed document and never modify it. Every edit method returns Result. Before a result is returned, its complete...
- [Formatting and sorting](https://zeropier.com/adotenv/docs/design/formatting/): Document::format and Document::sort return a FormatResult: the verified output and the text edits that produce it, with ranges into the original source. The...
- [Comparison and examples](https://zeropier.com/adotenv/docs/design/comparison/): Document::compare reports the keys whose effective declarations differ between two documents. Each document uses its own dialect for duplicates and lookup...
- [References and resolution](https://zeropier.com/adotenv/docs/design/expansion/): Parsing keeps $VAR, ${VAR:-default} and $(command) as literal text. Finding those references and resolving them are separate, explicit steps.
- [Loading files](https://zeropier.com/adotenv/docs/design/loading/): The load feature reads .env files from disk. Parsing itself never reads files, and loading never changes the process environment.
- [Serde](https://zeropier.com/adotenv/docs/design/serde/): The serde feature deserializes documents and loaded environments into typed values. It does not need std, so it also works in a no_std build with alloc.
- [Process environment](https://zeropier.com/adotenv/docs/guide/process/): adotenv-process applies a loaded environment to the current process. It is a separate crate because changing the process environment is unsafe: the...
- [config and Figment](https://zeropier.com/adotenv/docs/design/integrations/): Two adapter crates expose literal values to configuration libraries. Both keep their own 0.x version line, separate from the core.
- [Command-line tool](https://zeropier.com/adotenv/docs/design/cli/): adotenv-cli checks, formats, compares and loads .env files from a shell or a CI job. It uses the library APIs, so it reads files exactly as the library does.
### Performance and benchmarks
- [Benchmark overview](https://zeropier.com/adotenv/docs/benchmarks/): This directory contains the comparable benchmark methodology, reproducible commands, fixture catalogue, result schema and raw per-release evidence for adotenv.
- [Methodology](https://zeropier.com/adotenv/docs/benchmarks/methodology/): The release claim is about the modes that have a direct competitor API.
- [Reproduce benchmarks](https://zeropier.com/adotenv/docs/benchmarks/running/): - Linux x86_64 for the reference memory path. - Rust stable for Criterion and the workspace. - valgrind and the gungraun-runner matching the workspace...
- [Scenarios and fixtures](https://zeropier.com/adotenv/docs/benchmarks/scenarios/): The non-comparable shapes remain deterministic fixture targets for parser, edit, format, resolve and internal tests, but are not used for the competitive...
- [Result schema](https://zeropier.com/adotenv/docs/benchmarks/schema/): memory.jsonl contains one JSON object per case. Field names are stable; consumers must ignore unknown fields added in a later release.
- [Current map memory baseline](https://zeropier.com/adotenv/docs/benchmarks/memory/): Click a column header to sort. Use the filter to narrow large result sets.
- [Current compact memory baseline](https://zeropier.com/adotenv/docs/benchmarks/compact-memory/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.8.0 results](https://zeropier.com/adotenv/docs/benchmarks/results-1.8.0/): Status: publication-grade 1.8.0 compact-values, compact-entries and map evidence. Both the memory and speed matrices were recorded from clean 1.8.0 code...
- [1.8.0 compact memory](https://zeropier.com/adotenv/docs/benchmarks/compact-memory-1.8.0/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.8.0 speed](https://zeropier.com/adotenv/docs/benchmarks/speed-1.8.0/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.7.3 results](https://zeropier.com/adotenv/docs/benchmarks/results-1.7.3/): Status: publication-grade post-release 1.7.3 compact-values, compact-entries and map evidence. Both the memory and speed matrices were recorded from the...
- [1.7.3 compact memory](https://zeropier.com/adotenv/docs/benchmarks/compact-memory-1.7.3/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.7.3 speed](https://zeropier.com/adotenv/docs/benchmarks/speed-1.7.3/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.6.0 results](https://zeropier.com/adotenv/docs/benchmarks/results-1.6.0/): Status: publication-grade 1.6.0 compact-values and compact-entries evidence. Both the memory and speed matrices were recorded from the same clean...
- [1.6.0 compact memory](https://zeropier.com/adotenv/docs/benchmarks/compact-memory-1.6.0/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.6.0 speed](https://zeropier.com/adotenv/docs/benchmarks/speed-1.6.0/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.5.0 results](https://zeropier.com/adotenv/docs/benchmarks/results-1.5.0/): Status: publication-grade 1.5.0 compact-values evidence. The memory run is from the release candidate and the speed run is post-release, benchmark-only...
- [1.5.0 compact memory](https://zeropier.com/adotenv/docs/benchmarks/compact-memory-1.5.0/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.5.0 compact speed](https://zeropier.com/adotenv/docs/benchmarks/speed-1.5.0/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.4.1 results](https://zeropier.com/adotenv/docs/benchmarks/results-1.4.1/): Status: final 1.4.1 baseline, recorded on the dedicated Linux reference host at source SHA 0649096. Re-run this complete matrix if the benchmark code or...
- [1.4.1 map memory](https://zeropier.com/adotenv/docs/benchmarks/memory-1.4.1/): Click a column header to sort. Use the filter to narrow large result sets.
- [1.4.1 map speed](https://zeropier.com/adotenv/docs/benchmarks/speed/): Click a column header to sort. Use the filter to narrow large result sets.
- [Performance design](https://zeropier.com/adotenv/docs/design/performance/): These are reference measurements from one host, not CI thresholds. CI runs the benchmarks once as a smoke test.
### Reference
- [Diagnostic codes](https://zeropier.com/adotenv/docs/reference/diagnostics/): Every diagnostic has a stable code, a severity, a one-based line, a primary byte span and an optional secondary span. The codes, severities and spans are...
- [Security and limits](https://zeropier.com/adotenv/docs/reference/security/): .env files often hold secrets, and tools that read them often read files they did not write. This page collects what adotenv does and does not do on both...
- [Upgrading to 1.0](https://zeropier.com/adotenv/docs/reference/upgrading/): adotenv, adotenv-process and adotenv-cli 1.0.0 are the first stable releases. From 1.0, the library API, the CLI commands, exit codes and JSON output follow...
### Project
- [Architecture](https://zeropier.com/adotenv/docs/design/architecture/): adotenv separates syntax from meaning, and meaning from effects. Parsing records what the source says. A dialect decides what it means. Anything that...
- [Feature decisions](https://zeropier.com/adotenv/docs/design/feature-decisions/): Feature decisions use these rules.
- [Format contract](https://zeropier.com/adotenv/docs/design/format-contract/): adotenv and ayaml are independent parsers. This contract keeps their public surfaces consistent without shared types, a shared trait, or a dependency...
- [Language server](https://zeropier.com/adotenv/docs/design/lsp/): adotenv-lsp is an optional companion crate for editor integration. It keeps editor protocol work out of the parser and reuses the core document model...
- [Quality](https://zeropier.com/adotenv/docs/design/quality/): This page describes how adotenv is tested and what each check covers. The current coverage figures and known gaps are in the test audit.
- [Test audit](https://zeropier.com/adotenv/docs/design/test-audit/): This page records test coverage at the last release and the known gaps. Coverage is a guide, not a release gate. How the tests are organized is described in...
- [Heavy validation](https://zeropier.com/adotenv/docs/design/heavy-validation/): Status: adopted 2026-11-18 after a local mutation campaign exhausted the shared development host.
- [Release history](https://zeropier.com/adotenv/docs/design/releases/): Current release evidence is on the benchmark overview. Release plans and audit records.
- [Companion 0.4.0 / 0.8.0 plan](https://zeropier.com/adotenv/docs/design/companion-0.4-0.8-plan/): Status: Planned. Tracking issues: #277 (adotenv-lint 0.4.0) and #278 (adotenv-lsp 0.8.0).
- [1.8.0 and LSP stabilization plan](https://zeropier.com/adotenv/docs/design/1.8.0-plan/): Status: Complete across all three tracks (adotenv-lsp 0.6.0, adotenv / adotenv-process / adotenv-cli 1.8.0, and adotenv-lint 0.3.0). Tracking issues: #248...
- [1.6.0 plan](https://zeropier.com/adotenv/docs/design/1.6.0-plan/): Status: released on 2026-11-23. All planned core additions, post-merge audit fixes, focused mutation testing, publication-grade benchmark evidence...
- [1.5.0 plan](https://zeropier.com/adotenv/docs/design/1.5.0-plan/): Status: released. The compact values API is implemented and its publication-grade memory evaluation was recorded at 0a9fc92; the speed evaluation was...
- [1.4.1 plan](https://zeropier.com/adotenv/docs/design/1.4.1-plan/): Status: release complete; historical plan. Benchmark foundation (#73-#77), the
- [1.0 readiness](https://zeropier.com/adotenv/docs/design/1.0-readiness/): This page records the evidence behind the 1.0.0 release of adotenv, adotenv-process and adotenv-cli on 2026-10-31. adotenv-config and adotenv-figment were...
- [1.0 fix round](https://zeropier.com/adotenv/docs/design/1.0-fix-round/): A pre-release audit on 2026-10-30 found defects in behavior that 1.0 would freeze. They were fixed in 0.11.0, apart from E6, which shipped in 1.0.0 with a...
- [1.1 audit](https://zeropier.com/adotenv/docs/design/1.1-audit/): This page records the review of the 1.1.0 code base on 2026-11-02. It lists the findings, the evidence, the corrections to the first review report, and the...
## Full text bundle
- [llms-full.txt](https://zeropier.com/adotenv/llms-full.txt)