rust/library/core/tests
bors b33e234155 Auto merge of #79895 - Kerollmops:slice-group-by, r=m-ou-se
The return of the GroupBy and GroupByMut iterators on slice

According to https://github.com/rust-lang/rfcs/pull/2477#issuecomment-742034372, I am opening this PR again, this time I implemented it in safe Rust only, it is therefore much easier to read and is completely safe.

This PR proposes to add two new methods to the slice, the `group_by` and `group_by_mut`. These two methods provide a way to iterate over non-overlapping sub-slices of a base slice that are separated by the predicate given by the user (e.g. `Partial::eq`, `|a, b| a.abs() < b.abs()`).

```rust
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];

let mut iter = slice.group_by(|a, b| a == b);
assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);
```

[An RFC](https://github.com/rust-lang/rfcs/pull/2477) was open 2 years ago but wasn't necessary.
2020-12-31 12:00:43 +00:00
..
fmt mv std libs to library/ 2020-07-27 19:51:13 -05:00
hash mv std libs to library/ 2020-07-27 19:51:13 -05:00
num Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
alloc.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
any.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
array.rs Rollup merge of #76454 - poliorcetics:ui-to-unit-test-1, r=matklad 2020-09-28 18:39:39 +02:00
ascii.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
atomic.rs Migrate standard library away from compare_and_swap 2020-12-22 12:19:46 +01:00
bool.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
cell.rs Constantify UnsafeCell::into_inner and related 2020-11-04 11:41:57 +01:00
char.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
clone.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
cmp.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
const_ptr.rs Add tests 2020-12-26 03:45:51 +01:00
intrinsics.rs move test to intergrated test in library/core 2020-09-24 14:46:57 +00:00
iter.rs Add Iterator::intersperse 2020-12-30 12:07:19 -08:00
lazy.rs Make OnceCell<T> transparent to dropck 2020-08-18 00:34:54 +02:00
lib.rs Auto merge of #79895 - Kerollmops:slice-group-by, r=m-ou-se 2020-12-31 12:00:43 +00:00
macros.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
manually_drop.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
mem.rs Auto merge of #80511 - Mark-Simulacrum:bump-stage0, r=pietroalbini 2020-12-30 18:32:31 +00:00
nonzero.rs Added impl Rem<NonZeroU{0}> for u{0} which cannot panic 2020-12-17 18:42:19 +02:00
ops.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
option.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
pattern.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
pin.rs Make some methods of Pin<&mut T> unstable const 2020-09-18 19:23:50 +02:00
ptr.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
result.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00
slice.rs Check for exhaustion in SliceIndex for RangeInclusive 2020-10-20 17:18:08 -07:00
str_lossy.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
str.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
task.rs Move const tests for Poll to library\core 2020-09-04 01:04:34 +02:00
time.rs Fixup tests: Duration::MIN -> ::ZERO 2020-10-27 13:57:51 -07:00
tuple.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
unicode.rs Make ui test that are run-pass and do not test the compiler itself library tests 2020-11-30 02:47:32 +01:00