File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2570,6 +2570,20 @@ impl<'a> Replacer for &'a Cow<'a, str> {
2570
2570
}
2571
2571
}
2572
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
+ /// ```
2573
2587
impl < F : for < ' a > ReplacerClosure < ' a > > Replacer for F {
2574
2588
fn replace_append ( & mut self , caps : & Captures < ' _ > , dst : & mut String ) {
2575
2589
dst. push_str ( ( * self ) ( caps) . as_ref ( ) ) ;
You can’t perform that action at this time.
0 commit comments