pub struct WorkQueue<T: Clone> {
pub items: VecDeque<WorkItem<T>>,
pub processed_count: usize,
pub total_time: Duration,
pub avg_time: Duration,
}Expand description
Work queue for a single worker thread
Fields§
§items: VecDeque<WorkItem<T>>Double-ended queue for work items
processed_count: usizeNumber of items processed by this worker
total_time: DurationTotal execution time for this worker
avg_time: DurationAverage execution time per item
Implementations§
Source§impl<T: Clone> WorkQueue<T>
impl<T: Clone> WorkQueue<T>
Sourcepub fn push_front(&mut self, item: WorkItem<T>)
pub fn push_front(&mut self, item: WorkItem<T>)
Add work item to the front of the queue (for local work)
Sourcepub fn push_back(&mut self, item: WorkItem<T>)
pub fn push_back(&mut self, item: WorkItem<T>)
Add work item to the back of the queue (for stolen work)
Sourcepub fn steal_back(&mut self) -> Option<WorkItem<T>>
pub fn steal_back(&mut self) -> Option<WorkItem<T>>
Steal work from the back (work stealing)
Sourcepub fn update_timing(&mut self, executiontime: Duration)
pub fn update_timing(&mut self, executiontime: Duration)
Update timing statistics
Sourcepub fn estimated_load(&self) -> Duration
pub fn estimated_load(&self) -> Duration
Get the current load (estimated remaining work time)
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for WorkQueue<T>
impl<T> RefUnwindSafe for WorkQueue<T>where
T: RefUnwindSafe,
impl<T> Send for WorkQueue<T>where
T: Send,
impl<T> Sync for WorkQueue<T>where
T: Sync,
impl<T> Unpin for WorkQueue<T>where
T: Unpin,
impl<T> UnsafeUnpin for WorkQueue<T>
impl<T> UnwindSafe for WorkQueue<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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