pub(crate) fn written_entries<'a>(
entries: impl Iterator<Item = &'a (Value, Value)>,
) -> Vec<(Value, Value)>Expand description
Map entries a writer is about to emit out of pairs that came from a file:
normalised into the encoding SPEC.md requires, and with no key written
twice (deduplicated).
Normalising first is deliberate — it can create a collision, so a dedup
pass that ran before it would miss one. See deduplicated.
A list of pairs is not a map and can hold one key twice: a caller can build
such a list by hand, and a file that repeated a key no field could use
leaves one behind (see unrecognised). Until this pass existed both
entries went into the file. RFC 8949 calls a map with a repeated key
invalid, the JavaScript reader silently collapses one, and SPEC.md forbids
emitting one at all.
Used for every such list this crate writes: the header’s three stores
through store_entries, and on the event side
TraceEvent::extra and an unknown event
type’s fields. "custom" needs only the normalised half — a
BTreeMap cannot hold one key twice, so the dedup pass has nothing to
find there.