Skip to main content

apply_content_edits

Function apply_content_edits 

Source
pub fn apply_content_edits(
    content: &str,
    edits: &[ContentEdit],
) -> Result<ContentEditsResult>
Expand description

Apply ordered edits to an in-memory buffer.

All-or-nothing: if any op fails, returns Err and does not expose a partial buffer. On success, every op has been applied in order; each op sees the result of the previous one.

Diff headers use <buffer>. Prefer apply_content_edits_with_label when the host knows a real path (#1665).

Available with default features off as long as the replace path is compiled (always; no ast required).