-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(replace_with)]
This is a tracking issue for the implementation of replace_with and replacen_with for the String type in standart library, followed from the ACP (rust-lang/libs-team#344 (comment)).
This feature adds str::replace_with as an augmentation of str::replace and str::replacen_with as an augmentation of str:replacen to the standard library. Compared to the current versions, these functions allow for passing an f: impl FnMut(&str) -> S that can be used to produce replacements dynamically as well as to insert custom computations such as counting the number of changes.
Public API
// str::replace_with
fn replace_with<P: Pattern, S: AsRef<str>>(
&self,
from: P,
f: impl FnMut(&str) -> S,
) -> String;// str::replacen_with
fn replacen_with<P: Pattern, S: AsRef<str>>(
&self,
from: P,
f: impl FnMut(&str) -> S,
count: usize
) -> String;Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- ACP: rust-lang/libs-team#344
- Implementation: implement
replace_withandreplacen_withfor unstable featurereplace_with#147741 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.
Footnotes
Scripter17 and ozgurakgun
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.