diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-30 11:26:47 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-30 11:26:47 +0530 |
| commit | c731157395f7a02138d5531041578983a66f6f42 (patch) | |
| tree | ae5a37661f482432d0e5574e231e290d4bfcb322 /library/std/src/sys/unix/stack_overflow.rs | |
| parent | 9f4d5d2a28849ec0ecb2976ddc9946f65b626fe8 (diff) | |
| parent | 7a433e4d00969afe562d46e5314372f6d331d953 (diff) | |
| download | rust-c731157395f7a02138d5531041578983a66f6f42.tar.gz rust-c731157395f7a02138d5531041578983a66f6f42.zip | |
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.
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
