Skip to main content

prune_docs

Function prune_docs 

Source
pub fn prune_docs(
    rules: &IndexRules,
    docs: &mut [(Box<str>, Value)],
    tn_id: TnId,
    file_id: &str,
)
Expand description

Prune every exported document against the rules for its kind.

Applies the union of every matching part rule’s prune list, in parts declaration order, rather than one rule’s list at a time:

  1. Prune is a property of the document shape, not of the row a rule emits — two rules over one kind read the same JSON.
  2. Per-rule pruning would need a clone per rule, and would destroy “prune once, both of build_parts’ passes see it”.
  3. Deletion-only means a union can only remove more; it cannot make either rule’s output wrong in a way its own list would not have, only shorter.
  4. Declaration order is fixed, so the result is deterministic.

There is deliberately no validation forbidding two rules of one kind from both declaring prune: the union is already well defined, no shipped manifest has that shape, and it would be one more rule to defend.