Skip to main content

replace_text

Function replace_text 

Source
pub fn replace_text(
    path: &Path,
    from: &str,
    to: &str,
    opts: &ReplaceOptions,
    mode: ApplyMode,
    guard: Option<&PathGuard>,
) -> Result<EditResult>
Expand description

Replace text in a file using literal or regex matching.

When opts.insert_before or opts.insert_after is set, the matched text is preserved and the insertion is added adjacent to it.