-
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
Add char::code_point #83496
Add char::code_point #83496
Conversation
This method is equivalent to conversion using `as`, but with a more domain-specific name.
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
I see that CI failed due to a missing stability attribute. I admit to some confusion about how to handle this: does adding the attribute to |
@Aehmlo For library functions the former will suffice. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The example was previously based on the character "a," but was since revised to use a more "interesting" character. When making this change, I neglected to change the "magic number" in the doctest. On the upside, I think the tests should pass now.
All right, I think this one should do it. |
https://doc.rust-lang.org/core/str/fn.next_code_point.html serves as further naming precedent. |
This should not be insta-stable. It should be marked as unstable, with a tracking issue and a feature gate. Otherwise the method itself seems reasonable to me. |
ping from triage: |
Docs for the |
Yes, I'll stick this behind a feature gate (and probably rebase) when I get a chance — hopefully this weekend. Thanks for the link to the docs! |
@Aehmlo any updates on this? |
triage: |
In #79502, which introduced
From<char> for u{64,128}
, some desire for a dedicated code point method onchar
was expressed. This PR implementschar::code_point
(where the underscore comes from the fact that the documentation and Unicode both stylize it as two words, i.e., "code point" instead of "codepoint"). The method is simply implemented asself as u32
.