rust/library/core/src/iter
Dylan DPC f7febc8865
Rollup merge of #82570 - WaffleLapkin:split_whitespace_as_str, r=m-ou-se
Add `as_str` method for split whitespace str iterators

This PR adds `as_str` methods to `SplitWhitespace` and `SplitAsciiWhitespace`
str iterators. The methods return the remainder, similar to `as_str` methods on
`Chars` and other split iterators. This PR is a continuation of https://github.com/rust-lang/rust/pull/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
1. Make fields of some iterators `pub(crate)`
2. Add getter methods (like `into_inner`, `inner`, `inner_mut`...) to some (all) iterators
3. Completely rewrite `SplitWhitespace` and `SplitAsciiWhitespace`

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`
2021-03-19 23:01:35 +01:00
..
adapters Rollup merge of #82570 - WaffleLapkin:split_whitespace_as_str, r=m-ou-se 2021-03-19 23:01:35 +01:00
sources Remove multiline `use`s 2020-11-22 02:39:22 +03:00
traits Fix typo/inaccuracy in the documentation of Iterator::skip_while 2021-03-18 18:58:22 +01:00
mod.rs Add Iterator::intersperse_with 2020-12-31 23:09:13 +01:00
range.rs Use `#[rustc_inherit_overflow_checks]` instead of Add::add etc. 2021-02-14 23:06:36 +01:00
sources.rs Split iterator sources into different modules 2020-11-22 02:39:21 +03:00