adotenv-config
A config source adapter for literal
adotenv documents.
use parse_strict;
use AdotenvSource;
let doc = parse_strict?;
let config = builder
.add_source
.build?;
assert_eq!;
assert_eq!;
Typed extraction uses config's scalar coercion:
use Deserialize;
let app: App = config.try_deserialize?;
from_values accepts an explicit map, from_compact_values accepts
CompactValues (including results from load_values_compact and
load_cascade_values_compact), and from_compact_entries accepts
CompactEntries. The load feature adds from_environment for
LoadedEnvironment.
Keys
The adapter implements the config 0.15 Source trait and requires Rust 1.88.
config keeps key case and treats . as a nested path separator, so A.B is
key B inside table A, and A.B and a.b are different keys. A scalar
parent and a dotted child collide: with A=1 and A.B=2, config exposes
either the scalar or the nested table, not both, and the winner is a
config-implementation detail. Do not mix those shapes. Typed extraction
matches field names exactly: HOST=localhost does not fill a host field.
The adapter does not rewrite keys. Use from_values to supply keys that are
already normalized for config.
Values are decoded literals. Duplicate policy, lookup participation and
BareKeys::Empty follow the source document or loaded environment. The adapter
performs no expansion, command execution or file access.