c731157395
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. |
||
---|---|---|
.. | ||
alloc | ||
backtrace@4e5a3f7292 | ||
core | ||
panic_abort | ||
panic_unwind | ||
portable-simd | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@42df7394d3 | ||
test | ||
unwind |