Github Add `as_str` method for split whitespace str iterators by WaffleLapkin ·...
source link: https://github.com/rust-lang/rust/pull/82570
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
This PR adds as_str
methods to SplitWhitespace
and SplitAsciiWhitespace
str iterators. The methods return the remainder, similar to as_str
methods onChars
and other split iterators. This PR is a continuation of #75265, which added as_str
for all other str split iterators.
The feature gate for new methods is #![feature(str_split_whitespace_as_str)]
.
SplitWhitespace
and SplitAsciiWhitespace
use iterators under the hood, so to implement as_str
it's required to either
- Make fields of some iterators
pub(crate)
- Add getter methods (like
into_inner
,inner
,inner_mut
...) to some (all) iterators - Completely rewrite
SplitWhitespace
andSplitAsciiWhitespace
This PR uses the 1. approach since it's easier to implement and requires fewer changes (and no changes to the public API). If you think that's not the right way, please, tell me.
r? @m-ou-se
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK