tanzim-merge
Package | Documentation | Repository
Third stage of the tanzim pipeline: groups parsed payloads by entry name and merges their values.
The Merge trait
Implement [Merge] to define a custom merge strategy. The output is
[Merged] — a HashMap<Option<String>, (Vec<Payload>, LocatedValue)> keyed by entry
name, where the Vec<Payload> records which payloads contributed to each merged
value.
Grouping key
Payload::maybe_name determines the map key:
Some("foo")→ keySome("foo")None→ keyNone(all unnamed payloads share this bucket)
Built-in strategies
| Type | Behaviour |
|---|---|
LastWins |
Last value for each name fully replaces any previous value |
DeepMerge |
Maps are merged recursively; the overlay value wins at each non-map leaf |
Example
use ;
use Payload;
use Source;
use ;
let source = parse.unwrap;
let make_entry = ;
let list = vec!;
// LastWins: second entry fully replaces the first
let merged = LastWins.merge.unwrap;
let db = merged.get.unwrap;
let host = db.1.value.as_map.unwrap.get.unwrap;
assert_eq!;
Features
No default features. Opt-in logging / tracing emit log messages / trace
spans via the log / tracing crates.
Relations
- Consumes
LocatedValuefromtanzim-parse. - Uses
Payloadfromtanzim-load(which embedsSource) to track provenance. - Full pipeline wired in
tanzim.