-
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
Tracking Issue for split_at_checked #119128
Comments
I wonder if the |
Personally I’d rather not complicate the interface and have the methods on slice and on str return the same kind of value. No strong feelings though. |
core: introduce split_at{,_mut}_checked Introduce split_at_checked and split_at_mut_checked methods to slices types (including str) which are non-panicking versions of split_at and split_at_mut respectively. This is analogous to get method being non-panicking version of indexing. - rust-lang/libs-team#308 - rust-lang#119128
core: introduce split_at{,_mut}_checked Introduce split_at_checked and split_at_mut_checked methods to slices types (including str) which are non-panicking versions of split_at and split_at_mut respectively. This is analogous to get method being non-panicking version of indexing. - rust-lang/libs-team#308 - rust-lang#119128
core: introduce split_at{,_mut}_checked Introduce split_at_checked and split_at_mut_checked methods to slices types (including str) which are non-panicking versions of split_at and split_at_mut respectively. This is analogous to get method being non-panicking version of indexing. - rust-lang/libs-team#308 - rust-lang#119128
core: introduce split_at{,_mut}_checked Introduce split_at_checked and split_at_mut_checked methods to slices types (including str) which are non-panicking versions of split_at and split_at_mut respectively. This is analogous to get method being non-panicking version of indexing. - rust-lang/libs-team#308 - rust-lang#119128
Rollup merge of rust-lang#118578 - mina86:c, r=dtolnay core: introduce split_at{,_mut}_checked Introduce split_at_checked and split_at_mut_checked methods to slices types (including str) which are non-panicking versions of split_at and split_at_mut respectively. This is analogous to get method being non-panicking version of indexing. - rust-lang/libs-team#308 - rust-lang#119128
Thanks for pushing for this feature ❤️ I really want this to land! Panic free handling of byte slices has been in a pretty bad state a long time. I came here just now because I was trying out the new I just tried @mina86 You can check the implementation PR step in your initial comment. That's merged 🥳 |
@m-ou-se Can we get a fcp for this? Thanks in advance.
For consistency with the existing methods on
IMO returning option here should be fine. But |
We discussed this in the libs-api meeting and are happy to merge this as it is. The @rfcbot fcp merge |
Team member @Amanieu has proposed to merge 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. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
…plit-at-checked, r=jhpratt Stabilize `split_at_checked` Closes rust-lang#119128 For the const version of `slice::split_at_mut_checked`, I'm reusing the `const_slice_split_at_mut` feature flag (rust-lang#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...
Rollup merge of rust-lang#124678 - UserIsntAvailable:feat/stabilize-split-at-checked, r=jhpratt Stabilize `split_at_checked` Closes rust-lang#119128 For the const version of `slice::split_at_mut_checked`, I'm reusing the `const_slice_split_at_mut` feature flag (rust-lang#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...
this was duplicate of #90410. I would have prefer Result. This become stable very fast Oo. (nice) |
Feature gate:
#![feature(split_at_checked)]
.This is a tracking issue for the addition of
split_at_checked
andsplit_at_mut_checked
methods to[T]
andstr
types which are non-panicking versions ofsplit_at
andsplit_at_mut
methods. Rather than panicking when spit index is out of range (likesplit_at
does), the methods returnNone
.Public API
Steps / History
Unresolved Questions
Name of the methods. Some possibilities (suggested in ACP discussion):
split_at_checked
andsplit_at_mut_checked
— follows naming ofsplit_at_unchecked
andsplit_at_mut_unchecked
. Using suffix makes the names sort nicely together.checked_split_at
andchecked_split_at_mut
— follows naming convention of arithmetic types (e.g.checked_add
). Those new functions serve similar purpose as checked arithmetic operations.try_split_at
andtry_split_at_mut
— follows naming of various fallible methods such astry_from
,try_new
,try_for_each
etc. Shortest of the three suggestions.Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: