rust/library
Dylan DPC 977df43c4a
Rollup merge of #75265 - WaffleLapkin:str_split_as_str, r=dtolnay
Add `str::{Split,RSplit,SplitN,RSplitN,SplitTerminator,RSplitTerminator,SplitInclusive}::as_str` methods

tl;dr this allows viewing unyelded part of str-split-iterators, like so:
```rust
let mut split = "Mary had a little lamb".split(' ');
assert_eq!(split.as_str(), "Mary had a little lamb");
split.next();
assert_eq!(split.as_str(), "had a little lamb");
split.by_ref().for_each(drop);
assert_eq!(split.as_str(), "");
```

--------------

This PR adds semi-identical `as_str` methods to most str-split-iterators with signatures like `&'_ Split<'a, P: Pattern<'a>> -> &'a str` (Note: output `&str` lifetime is bound to the `'a`, not the `'_`). The methods are similar to [`Chars::as_str`]

`SplitInclusive::as_str` is under `"str_split_inclusive_as_str"` feature gate, all other methods are under `"str_split_as_str"` feature gate.

Before this PR you had to sum `len`s of all yielded parts or collect into `String` to emulate `as_str`.

[`Chars::as_str`]: https://doc.rust-lang.org/core/str/struct.Chars.html#method.as_str
2020-10-16 02:10:00 +02:00
..
alloc Fix typo in documentation 2020-10-15 16:57:19 +02:00
backtrace@893fbb2368 Bump backtrace-rs 2020-10-11 13:52:20 -04:00
core Rollup merge of #75265 - WaffleLapkin:str_split_as_str, r=dtolnay 2020-10-16 02:10:00 +02:00
panic_abort Rollup merge of #76866 - est31:master, r=lcnr 2020-09-20 15:51:50 +02:00
panic_unwind library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnu 2020-09-28 00:39:57 +02:00
proc_macro Bump to 1.48 bootstrap compiler 2020-10-07 19:51:36 -04:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Fix link to foreign calling conventions 2020-10-15 00:57:22 -07:00
stdarch@3c3664355e Update stdarch submodule 2020-10-01 13:06:22 -04:00
term
test Replace absolute paths with relative ones 2020-10-13 14:16:45 +02:00
unwind Remove useless all in cfg 2020-10-09 13:24:05 +02:00