rust/library/alloc
Dylan DPC c731157395
Rollup merge of #95376 - WaffleLapkin:drain_keep_rest, r=dtolnay
Add `vec::Drain{,Filter}::keep_rest`

This PR adds `keep_rest` methods to `vec::Drain` and `vec::DrainFilter` under `drain_keep_rest` feature gate:
```rust
// mod alloc::vec

impl<T, A: Allocator> Drain<'_, T, A> {
    pub fn keep_rest(self);
}

impl<T, F, A: Allocator> DrainFilter<'_, T, F, A>
where
    F: FnMut(&mut T) -> bool,
{
    pub fn keep_rest(self);
}
```

Both these methods cancel draining of elements that were not yet yielded from the iterators. While this needs more testing & documentation, I want at least start the discussion. This may be a potential way out of the "should `DrainFilter` exhaust itself on drop?" argument.
2022-08-30 11:26:47 +05:30
..
benches Optimized vec::IntoIter::next_chunk impl 2022-07-26 20:31:43 +02:00
src Rollup merge of #95376 - WaffleLapkin:drain_keep_rest, r=dtolnay 2022-08-30 11:26:47 +05:30
tests Rollup merge of #95376 - WaffleLapkin:drain_keep_rest, r=dtolnay 2022-08-30 11:26:47 +05:30
Cargo.toml Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00