-
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
Add u8::from_ascii_to_digit #96110
Add u8::from_ascii_to_digit #96110
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @scottmcm (rust-highfive has picked a reviewer for you, use r? to override) |
r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That not what is asked, the point of The signature the issue is looking for is: const fn to_ascii_digit(self, radix: u8) -> Option<Self>;
// or
const fn from_ascii_digit(self, radix: u8) -> Option<Self>;
// I prefer this one cause self is admited to be a ascii_digit we when to convert to u8 (as the issue is looking for)
// to_ascii_digit look more like the reverse of what the issue is looking for panic for radix > 36. |
In addition to what Stargateur said, I suggest that the result be an option for consistency with |
Ahh. My bad. I'll look into this in a minute, thanks so much for the correction 👍 |
@rustbot author |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[The force push was a squash] |
that why I advice |
Agreed, the name is a bit confusing. Renaming to |
Please note that the new method is supposed to parallel |
@hniksic |
I'm reassigning this PR because I'm taking a break from the review rotation for a little while. Thank you for your patience. r? rust-lang/libs-api |
@Stargateur I see your point. Maybe |
from_ascii_to_digit SGTM Although I'd like to hear other people's takes on it before changing it =D |
@rustbot author |
Renamed to |
@rust-lang/libs-api: I think I would prefer not to add this method. The behavior of the proposed method is that Overall the benefit gained by giving this a name As a counterproposal to the contributor, if they are interested, I would suggest to explore what a more fleshed out |
Team member @dtolnay has proposed to close this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Just to make it clear, feedback regarding the implementation details, I'd be glad to consider and improve upon it. @dtolnay However, I do agree that a more fleshed dedicated module to ASCII utilities might be better rather than pushing more methods into u8. |
👍 to closing in favour of something else later. Having an (Such a type could even have a validity invariant of being actually ascii...) |
Fixes #95969