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.

Panics on an edit that does not fit the text its predecessors produced. To verify a slice rather than materialize it — the reason a span-mapping consumer reaches for this — use edits_produce, which is total and skips the final rebuild.