pub(super) struct DrainGuard<'a, T, C: From<Vec<T>>> {
    collection: &'a mut C,
    vec: Vec<T>,
}Expand description
A proxy for draining a collection by converting to a Vec and back.
This is used for draining BinaryHeap and VecDeque, which both have
zero-allocation conversions to/from Vec, though not zero-cost:
BinaryHeapwill heapify fromVec, but at least that will be empty.VecDequehas to shift items to offset 0 when converting toVec.
Fields§
§collection: &'a mut C§vec: Vec<T>Implementations§
Trait Implementations§
Source§impl<'a, T, C> ParallelDrainRange for &'a mut DrainGuard<'_, T, C>
 
impl<'a, T, C> ParallelDrainRange for &'a mut DrainGuard<'_, T, C>
Auto Trait Implementations§
impl<'a, T, C> Freeze for DrainGuard<'a, T, C>
impl<'a, T, C> RefUnwindSafe for DrainGuard<'a, T, C>where
    C: RefUnwindSafe,
    T: RefUnwindSafe,
impl<'a, T, C> Send for DrainGuard<'a, T, C>
impl<'a, T, C> Sync for DrainGuard<'a, T, C>
impl<'a, T, C> Unpin for DrainGuard<'a, T, C>where
    T: Unpin,
impl<'a, T, C> !UnwindSafe for DrainGuard<'a, T, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more