Skip to main content

apply_edits

Function apply_edits 

Source
pub fn apply_edits(old: &str, edits: &[Edit]) -> String
Expand description

Apply edits to old left-to-right, each expressed against the text its predecessors produced — the inverse operation to map_range_through_edits.

Used as an apply-and-verify guard by span-mapping consumers: reconstructing the current text from an old snapshot plus an accumulated edit slice proves the slice is the exact transform between them before a range is folded through it, so a stale or misaligned slice can be rejected in favor of the whole-text diff_edit fallback.