Skip to main content

replace_all

Function replace_all 

Source
pub fn replace_all(
    pattern: &FindPattern,
    lines: &[String],
    replacement: &str,
) -> Option<(Vec<String>, usize)>
Expand description

Rewrite every match in lines, returning the new lines and how many matches were rewritten. The replace all primitive.

Returns None when nothing matched, so callers can distinguish “no work” from “rewrote zero characters” without re-counting.