-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for split_inclusive #72360
Comments
…king_issue, r=shepmaster split_inclusive: add tracking issue number (72360) Adds tracking issue number ( rust-lang#72360 ) to the unstable feature attributes.
…king_issue, r=shepmaster split_inclusive: add tracking issue number (72360) Adds tracking issue number ( rust-lang#72360 ) to the unstable feature attributes.
…king_issue, r=shepmaster split_inclusive: add tracking issue number (72360) Adds tracking issue number ( rust-lang#72360 ) to the unstable feature attributes.
We also need EDIT: wait, I guess |
@matklad I planned using it also for lines_inclusive -like functionality, but didn't thought about it exhaustively. Indeed, it's a nice plus that \r\n seems to work. I guess that \r (and especially the others https://en.wikipedia.org/wiki/Newline#Representation) is such a rarity these days that another method is not warranted. I'll send a doc PR for that use case! Also, I think that a stabilization would be warranted soonish. What ya'll think? |
Stabilize split_inclusive ### Contents of this MR This stabilises: * `slice::split_inclusive` * `slice::split_inclusive_mut` * `str::split_inclusive` Closes rust-lang#72360. ### A possible concern The proliferation of `split_*` methods is not particularly pretty. The existence of `split_inclusive` seems to invite the addition of `rsplit_inclusive`, `splitn_inclusive`, etc. We could instead have a more general API, along these kinds of lines maybe: ``` pub fn split_generic('a,P,H>(&'a self, pat: P, how: H) -> ... where P: Pattern where H: SplitHow; pub fn split_generic_mut('a,P,H>(&'a mut self, pat: P, how: H) -> ... where P: Pattern where H: SplitHow; trait SplitHow { fn reverse(&self) -> bool; fn inclusive -> bool; fn limit(&self) -> Option<usize>; } pub struct SplitFwd; ... pub struct SplitRevInclN(pub usize); ``` But maybe that is worse. ### Let us defer that? ### This seems like a can of worms. I think we can defer opening it now; if and when we have something more general, these two methods can become convenience aliases. But I thought I would mention it so the lang API team can consider it and have an opinion.
This is a tracking issue for
split_inclusive
APIs for slice and str.The feature gate for the issue is
#![feature(split_inclusive)]
.API overview
split_inclusive
forslice
andstr
andsplit_inclusive_mut
forslice
split_inclusive
is a substring/subslice splitting iterator that includes the matched part in the iterated substrings as a terminator.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Unresolved Questions
No known unresolved questions at the moment.
Implementation history
Implementation: #67330
The text was updated successfully, but these errors were encountered: