Open
Description
Feature gate: #![feature(slice_split_once)]
This is a tracking issue for the slice::split_once
and slice::rsplit_once
methods, which split a slice into two chunks on the first occurrence of a single-element delimiter. These mirror the existing stable str::split_once
and str::rsplit_once
. I expect these to be mostly used for ad-hoc parsing data that is not UTF-8.
Public API
// core::slice
impl [T] {
pub fn split_once<F>(&self, pred: F) -> Option<(&[T], &[T])>
where
F: FnMut(&T) -> bool;
pub fn rsplit_once<F>(&self, pred: F) -> Option<(&[T], &[T])>
where
F: FnMut(&T) -> bool;
}
Steps / History
- ACP: ACP: add slice::split_once libs-team#102
- Implementation: Implement
slice::split_once
andslice::rsplit_once
#112818 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Should we include
split_once_mut
andrsplit_once_mut
?