(w: &mut W, string: &str, from: &str, to: &str)
| 284 | |
| 285 | #[inline] |
| 286 | fn replace_into_writer<W: StringWriter>(w: &mut W, string: &str, from: &str, to: &str) { |
| 287 | let mut last_end = 0; |
| 288 | for (start, _part) in string.match_indices(from) { |
| 289 | w.write_str(&string[last_end..start]); |
| 290 | w.write_str(to); |
| 291 | last_end = start + from.len(); |
| 292 | } |
| 293 | w.write_str(&string[last_end..]); |
| 294 | } |
| 295 | |
| 296 | #[cfg(test)] |
| 297 | mod tests { |
no test coverage detected
searching dependent graphs…