Skip to main content

Crate knf_core

Crate knf_core 

Source
Expand description

Layered merge over an owned Value tree.

One walk, one value type. Every format parses into Value before merging, so JSON and TOML layers stack without a conversion in the middle. This crate knows nothing about files, formats or the command line; parsing, emission and provenance are all the caller’s job.

thiserror and indexmap are the only dependencies — neither is a format crate. cargo tree -p knf-core --depth 1 is the enforcement.

Structs§

MergeOptions
Knobs on the merge itself. Passed by reference rather than encoded as cargo features: features are additive and unify across a dependency graph, so a strict feature would silently change behaviour for one consumer the moment a second consumer enabled it.
RuleErrors
Every problem with a rule set, sorted.
Rules
A validated set of per-path strategies, shaped as a trie.

Enums§

MergeError
Number
A number, kept in the widest lossless representation of its source.
RuleError
Why a rule set was rejected.
Strategy
What to do where a layer supplies a value for a path that already has one.
Value
A parsed document, or any node within one.

Functions§

merge
Folds a list of layers into one document, last-wins, seeded with an empty object.
merge_into
Merges over into base in place.
merge_with
Folds a list of layers into one document, seeded with an empty object.

Type Aliases§

Map
The object type. indexmap rather than BTreeMap so input key order survives, and rather than Vec<(String, Value)> so merge’s per-key lookup is not quadratic.