Skip to main content

prune_document

Function prune_document 

Source
pub fn prune_document(doc: &mut Value, patterns: &[String]) -> (usize, usize)
Expand description

Apply one part rule’s prune list to one document, in declaration order.

Each pattern re-queries the already-mutated document, so a later pattern sees what the earlier ones left. Returns (deleted, failed): nodes actually removed, and patterns that could not be evaluated.

A failing pattern is skipped rather than propagated — see the module docs on why partial pruning is harmless. It leaves the document less pruned, never wrong: no text is lost and nothing is fabricated (on ordering, see the module note on swap-remove).