We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43222f2 commit 2c8c8ddCopy full SHA for 2c8c8dd
src/regex/string.rs
@@ -2570,6 +2570,20 @@ impl<'a> Replacer for &'a Cow<'a, str> {
2570
}
2571
2572
2573
+/// Blanket implementation of `Replacer` for closures.
2574
+///
2575
+/// This implementation is basically the following, except that the return type
2576
+/// `T` may optionally depend on lifetime `'a`.
2577
2578
+/// ```ignore
2579
+/// impl<F, T> Replacer for F
2580
+/// where
2581
+/// F: for<'a> FnMut(&a Captures<'_>) -> T,
2582
+/// T: AsRef<str>, // `T` may also depend on `'a`, which cannot be expressed easily
2583
+/// {
2584
+/// /* … */
2585
+/// }
2586
+/// ```
2587
impl<F: for<'a> ReplacerClosure<'a>> Replacer for F {
2588
fn replace_append(&mut self, caps: &Captures<'_>, dst: &mut String) {
2589
dst.push_str((*self)(caps).as_ref());
0 commit comments