Load, merge and emit layered JSON and TOML configuration.
Three steps, each a function, and a caller composes them:
- [
load_layers] reads each path into a [Value], keeping the format it was read as; - [
merge] folds the flat layer list from left to right — any in-memory overlays are just more layers appended to the list; - [
interpolate], if wanted, resolves${...}references once, on the merged document.
[format::emit] renders the result. JSON and TOML appear only in
format and [value]; the merge and interpolation never learn either
exists.
No flag names. An error from this crate carries key paths and file paths;
the command-line spelling that produced it is knf-cli's to add. That is
what [LoadError] exists for — the failures that have an obvious
command-line remedy are typed, so the caller decides how to name them.