Tracking Issue for substr_range
and related methods #126769
Open
Description
opened on Jun 21, 2024
Feature gate: #![feature(substr_range)]
This is a tracking issue for str::substr_range
, slice::subslice_range
, and slice::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
impl str {
fn substr_range(&self, substr: &str) -> Option<Range<usize>>;
}
impl<T> [T] {
fn subslice_range(&self, subslice: &[T]) -> Option<Range<usize>>;
fn element_offset(&self, elem: &T) -> Option<usize>;
}
Steps / History
- ACP
- Implementation: Add elem_offset and related methods #126770
- Rename
elem_offset
toelement_offset
#132830 - Final comment period (FCP)1
- Stabilization PR
Activity