-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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_strip
feature
#73413
Comments
Implement `slice_strip` feature Tracking issue: rust-lang#73413
Implement `slice_strip` feature Tracking issue: rust-lang#73413
Implement `slice_strip` feature Tracking issue: rust-lang#73413
Implement `slice_strip` feature Tracking issue: rust-lang#73413
Hi. I accidentally used one of these functions, I think because I was reading the docs for I'd like to see them stabilised. Since the docs tickbox was unticked I looked at the docs, and I have I made an MR for some slight docs wording improvements: #75078 I think this is probably ready for stabilisation. @lzutao Thanks for your contribution here. Do you intend to do the stabilisation report etc.? |
I think it is a bit soon to stabilize this feature. It is about one month after the feature is merged and appeared on nightly. |
I'm also interested! I want to use this to trim null bytes from the end of a slice. |
Could you give some example code show how do you do that with |
You're right, what I'm looking for is a slice equivalent to |
I just don't know if we want the API as it is, because we could bound the prefix/suffix arguments by Pattern API Anyway, If you want to stabilize this API, you could just send a PR and ping T-libs for their decisions. |
lzutao writes ("Re: [rust-lang/rust] Tracking Issue for `slice_strip` feature (#73413)"):
I just don't know if we want the API as it is, because we could bound the
prefix/suffix arguments by Pattern APIs
like str. @withoutboats and some folks was talking about fixing Pattern API for
slices.
AIUI providing these functions now, as taking slices for the patterns,
does not preclude generalising things later with a slice Pattern API.
The current unstable strip_* functions match the signatures of the
starts_with and ends_with, as discussed in #73414.
Ie, AIUI subsequently introducing such a alice Pattern API would not
be a breaking change. If I'm wrong about that then stabilising
starts_with and ends_with in their current form seems like it was a
mistake ?
Anyway, If you want to stabilize this API, you could just send a PR and ping
T-libs for their decisions.
The stabilisation checklist says to look at the docs. I have an
outstanding MR #75078 to improve the docs. Unfortunately that seems
to have become stuck waiting for review.
Would you be able to look into that ?
Thanks,
Ian.
…--
Ian Jackson <ijackson@chiark.greenend.org.uk> These opinions are my own.
Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.
|
Ah yeah, I forgot about this, thanks for pointing it out.
I'm not really sure, T-libs member should have more experience to answer this question.
My English is not great, so I pinged Joshua for review your PR.
You could always send a PR for stabilization, documentation improvements is not a blocker for stabilizing it. |
My English is not great, so I pinged Joshua for review your [docs] PR.
Thanks.
You could always send a PR for stabilization, documentation
improvements is not a blocker for stabilizing it.
Oh, I didn't realise that. I will do a stabilisation PR then.
Thanks,
Ian.
…--
Ian Jackson <ijackson@chiark.greenend.org.uk> These opinions are my own.
Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.
|
The stabilisation issue, rust-lang#73413, has an open item for documentation. I looked at the docs and it is all there, but I felt it could do with some minor wording improvement. I looked at the `str::strip_prefix` docs for a template. (That resulted in me slightly changing that doc too.) I de-linkified `None` and `Some`, as I felt that rather noisy.. I searched stdlib, and these don't seem to be usually linkified. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Stabilize slice::strip_prefix and slice::strip_suffix These two methods are useful. The corresponding methods on `str` are already stable. I believe that stablising these now would not get in the way of, in the future, extending these to take a richer pattern API a la `str`'s patterns. Tracking PR: rust-lang#73413. I also have an outstanding PR to improve the docs for these two functions and the corresponding ones on `str`: rust-lang#75078 I have tried to follow the [instructions in the dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr). The part to do with `compiler/rustc_feature` did not seem applicable. I assume that's because these are just library features, so there is no corresponding machinery in rustc.
Stabilize slice::strip_prefix and slice::strip_suffix These two methods are useful. The corresponding methods on `str` are already stable. I believe that stablising these now would not get in the way of, in the future, extending these to take a richer pattern API a la `str`'s patterns. Tracking PR: rust-lang#73413. I also have an outstanding PR to improve the docs for these two functions and the corresponding ones on `str`: rust-lang#75078 I have tried to follow the [instructions in the dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr). The part to do with `compiler/rustc_feature` did not seem applicable. I assume that's because these are just library features, so there is no corresponding machinery in rustc.
Closed by #77853 . |
The feature gate for the issue is
#![feature(slice_strip)]
.This feature adds two new methods to
[T]
:This is an analogy feature like
str::strip_{prefix,suffix}
but has the same signature of slice's{starts,ends}_with
.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
None
Implementation history
slice_strip
feature #73414[u8]
: https://rust.godbolt.org/z/iMcqf-The text was updated successfully, but these errors were encountered: