-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 substr_range
and related methods
#126769
Comments
substr_range
and related methods
Bikeshed: |
+1 I originally thought that "element" seems kinda long, but it's actually shorter than "subslice", so I think it's fine.
|
Should they be const? |
Good question I think that it would be great for them to be const, but a const implementation does not seem to be trivial in current-day rust. I can see two main ways of implementing something similar to the proposed methods:
Fortunately, the most common use cases aren't currently const either. Methods like Making these methods const is a non-breaking change, so I personally think that we should move forwards with non-const implementations and file a separate issue in the future if constness is desired enough. |
Add elem_offset and related methods Implementation of rust-lang#126769
Rollup merge of rust-lang#126770 - wr7:master, r=Amanieu Add elem_offset and related methods Implementation of rust-lang#126769
The documentation for
My initial impression of the second part of this statement was that an empty slice that was within the slice would return Looking at the code, the meaning appears to be that a slice that points to a byte inside a single element returns
The same comment applies to
|
I've created a PR (#132830) that includes the documentation changes that you suggested (with some minor modifications) and implements the renaming suggested by @tgross35. |
…tgross35 Rename `elem_offset` to `element_offset` Tracking issue: rust-lang#126769 Renames `slice::elem_offset` to `slice::element_offset` and improves the documentation of it and its related methods. The current documentation can be misinterpreted (as explained [here](rust-lang#126769 (comment))).
Rollup merge of rust-lang#132830 - wr7:substr_range_documentation, r=tgross35 Rename `elem_offset` to `element_offset` Tracking issue: rust-lang#126769 Renames `slice::elem_offset` to `slice::element_offset` and improves the documentation of it and its related methods. The current documentation can be misinterpreted (as explained [here](rust-lang#126769 (comment))).
Rename `elem_offset` to `element_offset` Tracking issue: #126769 Renames `slice::elem_offset` to `slice::element_offset` and improves the documentation of it and its related methods. The current documentation can be misinterpreted (as explained [here](rust-lang/rust#126769 (comment))).
Feature gate:
#![feature(substr_range)]
This is a tracking issue for
str::substr_range
,slice::subslice_range
, andslice::elem_offset
as described in this ACP.These methods can be used for error handling and to extend
str::lines
,str::split
,slice::split
, and other related methods.Public API
Steps / History
elem_offset
toelement_offset
#132830Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: