Skip to main content

apply_edits

Function apply_edits 

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

Apply every edit to source, returning the rewritten text.

Edits are applied from the highest byte offset to the lowest so that earlier edits’ offsets stay valid as later (already-applied) ones shift the text around them. Overlapping edits are not supported — callers must ensure each targets a disjoint span (true by construction here: every caller in this workspace produces at most one edit per top-level item).