pub enum Stealer<T> {
Owner(Vec<T>),
Taker(StealHandle<T>),
}
Expand description
Stealers swap out and take ownership of buffers in entirety from Workers
Variants§
Owner(Vec<T>)
Stealer was created with an owned batch that can simply be unwrapped
Taker(StealHandle<T>)
A Steal Handle buffer swaps either by taking the buffer directly or by awaiting the Worker to send on write completion
Implementations§
Source§impl<T> Stealer<T>
impl<T> Stealer<T>
Sourcepub async fn take(self) -> Vec<T>
pub async fn take(self) -> Vec<T>
Take the entire queue by swapping the underlying buffer and converting back into a Vec<T>
or by waiting to receive the buffer from the Worker if a write was in progress.
Sourcepub fn take_blocking(self) -> Vec<T>
pub fn take_blocking(self) -> Vec<T>
Take the entire queue by swapping the underlying buffer and converting into a Vec<T>
or by blocking to receive from the Worker if a write was in progress. This is always non-blocking when called on the same thread as the Worker
Trait Implementations§
Source§impl<T> From<Stealer<T>> for Vec<T>
Uses Stealer::take_blocking
; non-blocking when called on the same thread as Worker
impl<T> From<Stealer<T>> for Vec<T>
Uses Stealer::take_blocking
; non-blocking when called on the same thread as Worker
impl<T: Send> Send for Stealer<T>
impl<T: Send> Sync for Stealer<T>
Auto Trait Implementations§
impl<T> Freeze for Stealer<T>
impl<T> !RefUnwindSafe for Stealer<T>
impl<T> Unpin for Stealer<T>where
T: Unpin,
impl<T> !UnwindSafe for Stealer<T>
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