External Publication
Visit Post

Generic slice `replace`

Rust Internals [Unofficial] April 25, 2026
Source

It'd be nice if this were generic:

pub fn replace<P>(&self, from: P, to: &[T]) -> Vec<T>
where
    P: Pattern

very related:

  • Pre-RFC: New generic string pattern API for &str

Discussion in the ATmosphere

Loading comments...