Struct rayon::collections::drain_guard::DrainGuard
source · 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:
BinaryHeap
will heapify fromVec
, but at least that will be empty.VecDeque
has 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