Add str pointer methods (take 2)#91218
Add str pointer methods (take 2)#91218WaffleLapkin wants to merge 4 commits intorust-lang:masterfrom
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
m-ou-se
left a comment
There was a problem hiding this comment.
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_ptrandmut_str_ptrlang 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