You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tracking issue for the methods implemented in #75265 and #82570, which allow viewing the remainder of the underlying string in str-split iterators. E.g.:
letmut split = "Mary had a little lamb".split(' ');assert_eq!(split.remainder(),Some("Mary had a little lamb"));
_ = split.next();assert_eq!(split.remainder(),Some("had a little lamb"));
split.by_ref().for_each(drop);assert_eq!(split.remainder(),None);
The feature gates for the issue are #![feature(str_split_remainder)] (for most split iterators), #![feature(str_split_inclusive_remainder)] (for SplitInclusive) and #![feature(str_split_whitespace_remainder)] (for SplitWhitespace and SplitAsciiWhitespace).
Public API
// mod core::strimpl<'a,P:Pattern<'a>>Split<'a,P>{fnremainder(&self) -> Option<&'astr>;}// And the same for// - `RSplit<'a, P>`// - `SplitTerminator<'a, P>`// - `RSplitTerminator<'a, P>`// - `SplitN<'a, P>`// - `RSplitN<'a, P>`// - `SplitWhitespace<'a>`// - `SplitAsciiWhitespace<'a>`// - `SplitInclusive<'a, P>`
View all comments
This is a tracking issue for the methods implemented in #75265 and #82570, which allow viewing the remainder of the underlying string in str-split iterators. E.g.:
The feature gates for the issue are
#,# and#.Public API
Steps
Unresolved Questions
Should empty strings point to the end of the haystack, or they can be arbitrary constants? (see Addstr::{Split,RSplit,SplitN,RSplitN,SplitTerminator,RSplitTerminator,SplitInclusive}::as_strmethods #75265 (comment))Noneis now returned instead of an empty string, making this irrelevantImplementation history
Add
str::{Split,RSplit,SplitN,RSplitN,SplitTerminator,RSplitTerminator,SplitInclusive}::as_strmethods #75265 — implementedas_strmethods oncore::str::{Split,RSplit,SplitN,RSplitN,SplitTerminator,RSplitTerminator,SplitInclusive}Add
as_strmethod for split whitespace str iterators #82570 — implementedas_strmethods oncore::str::{SplitWhitespace, SplitAsciiWhitespace}Split*::as_strrefactor #95644 — renamedas_str=>remainderand changed return type toOption<&str>