-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 slice_split_once
#112811
Comments
Feature gate is slice_split_once and tracking issue is rust-lang#112811.
Hm, I would have expect the following signature here:
With the predicate, we allow only single-element delimiters, which I think lowers the added utility here. With slice-delimiter, this function also encapsulates With |
Yeah, I generally think It's probably too late to introduce a Pattern-like API for slices in a backwards-compatible way, or switch the existing methods to work with |
…uviper Implement `slice::split_once` and `slice::rsplit_once` Feature gate is `slice_split_once` and tracking issue is rust-lang#112811. These are equivalents to the existing `str::split_once` and `str::rsplit_once` methods.
…uviper Implement `slice::split_once` and `slice::rsplit_once` Feature gate is `slice_split_once` and tracking issue is rust-lang#112811. These are equivalents to the existing `str::split_once` and `str::rsplit_once` methods.
…uviper Implement `slice::split_once` and `slice::rsplit_once` Feature gate is `slice_split_once` and tracking issue is rust-lang#112811. These are equivalents to the existing `str::split_once` and `str::rsplit_once` methods.
…uviper Implement `slice::split_once` and `slice::rsplit_once` Feature gate is `slice_split_once` and tracking issue is rust-lang#112811. These are equivalents to the existing `str::split_once` and `str::rsplit_once` methods.
For slices with arbitrary |
Hmm, yeah I like that in the abstract. I think the main argument against it is that it's inconsistent with the existing |
The doc comments for these methods look to have a typo currently, which I just tripped over in the docs: "If any matching elements are resent in the slice [...]". After a moment of confusion ("resent? re-sent? recent?"), I realised that they were probably meant to read present. I'd happily patch it but I'm not familiar with the process, so I thought I'd just mention it here instead. |
"present" is presumably correct. As for process, just open a PR. Someone will be assigned to review it — don't worry if it takes a while. |
…Denton Fix typo in docs for slice::split_once, slice::rsplit_once This fixes a typo in the doc comments for these methods, which I tripped over while reading the docs: "If any matching elements are **resent** in the slice [...]", which is presumably meant to read **present**. I mentioned this in rust-lang#112811, the tracking issue for `slice_split_once`, and was encouraged to open a PR.
…Denton Fix typo in docs for slice::split_once, slice::rsplit_once This fixes a typo in the doc comments for these methods, which I tripped over while reading the docs: "If any matching elements are **resent** in the slice [...]", which is presumably meant to read **present**. I mentioned this in rust-lang#112811, the tracking issue for `slice_split_once`, and was encouraged to open a PR.
Rollup merge of rust-lang#119657 - cls:slice_split_once-typo, r=ChrisDenton Fix typo in docs for slice::split_once, slice::rsplit_once This fixes a typo in the doc comments for these methods, which I tripped over while reading the docs: "If any matching elements are **resent** in the slice [...]", which is presumably meant to read **present**. I mentioned this in rust-lang#112811, the tracking issue for `slice_split_once`, and was encouraged to open a PR.
I was just reaching for |
I think adding this is probably a good idea, but if we're going to add Either way, I'm gonna wait until we have a decision on whether return types should include the delimiter (#119799) before submitting a PR for the |
I'm a newbie, but I thought I'd still stick my oar in. The change in #119799 seems fine, but I wondered if an alternative might be to leave returning the separator to a separate method. In a vacuum that might seem clumsy, but my thinking is that, as @huonw said, returning the separator would be required for However, this won't be an issue if the thinking is that I don't know — food for thought. |
I like the Another option might be to have something like |
Feature gate:
#![feature(slice_split_once)]
This is a tracking issue for the
slice::split_once
andslice::rsplit_once
methods, which split a slice into two chunks on the first occurrence of a single-element delimiter. These mirror the existing stablestr::split_once
andstr::rsplit_once
. I expect these to be mostly used for ad-hoc parsing data that is not UTF-8.Public API
Steps / History
slice::split_once
andslice::rsplit_once
#112818Unresolved Questions
split_once_mut
andrsplit_once_mut
?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: