-
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 str pointer methods (take 2) #91218
Conversation
This comment has been minimized.
This comment has been minimized.
7bb8644
to
fdf5382
Compare
☔ The latest upstream changes (presumably #91627) made this pull request unmergeable. Please resolve the merge conflicts. |
These items allow to make inherent impls for `*const str` and `*mut str`.
fdf5382
to
c66ef2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for splitting that PR!
This looks great. I only have some small comments on the documentation:
This patch adds the following methods to `*const str` and `*mut str`: - `len` - `as_ptr` (`as_mut_ptr`) - `get_unchecked` (`get_unchecked_mut`) Similar methods have already existed for raw slices.
This patch adds the following methods to `NonNull<str>`: - `len` - `as_non_null_ptr` - `as_mut_ptr` - `get_unchecked_mut` Similar methods have already existed for raw slices, raw strings and nonnull raw slices.
This commit changes documentation of the following methods as proposed by the PR review - `<*const [T]>::len` - `<*mut [T]>::len` - `<*const str>::len` - `<*mut str>::len` - `<*const str>::get_unchecked` - `<*mut str>::get_unchecked_mut` - `NonNull::<str>::get_unchecked_mut`
c66ef2c
to
bb73eab
Compare
@m-ou-se I've edited the documentation as you suggested |
Actually... I now dought that these APIs are useful. While So I'm not sure that using and operating on |
I'm going to close this PR per the reasoning above. Feel free to ping me, if you disagree and think that these APIs are useful. |
This PR adds the following functions for pointers to
str
, similar to already existing functions for pointers to[T]
.This PR also adds
const_str_ptr
andmut_str_ptr
lang items (they are required for *const str and *mut str impls).This was previously proposed in #85816. This PR includes changes proposed by the review and was created to split these changes from the addition of pointer-to-str-construction methods (#91216).
r? @m-ou-se