struct ThreadContext<'env, Rn: Range, Input, Output, Accum: ThreadAccumulator<Input, Output>> {
id: usize,
num_active_threads: Arc<AtomicUsize>,
worker_status: Arc<Status<WorkerStatus>>,
main_status: Arc<Status<MainStatus>>,
range: Rn,
input: &'env [Input],
output: Arc<Mutex<Option<Output>>>,
accumulator: Accum,
}Expand description
Context object owned by a worker thread.
Fields§
§id: usizeThread index.
num_active_threads: Arc<AtomicUsize>Number of worker threads active in the current round.
worker_status: Arc<Status<WorkerStatus>>Status of the worker threads.
main_status: Arc<Status<MainStatus>>Status of the main thread.
range: RnRange of items that this worker thread needs to process.
input: &'env [Input]Reference to the inputs to process.
output: Arc<Mutex<Option<Output>>>Output that this thread writes to.
accumulator: AccumFunction to map and reduce inputs into the output.
Implementations§
Source§impl<Rn: Range, Input, Output, Accum: ThreadAccumulator<Input, Output>> ThreadContext<'_, Rn, Input, Output, Accum>
impl<Rn: Range, Input, Output, Accum: ThreadAccumulator<Input, Output>> ThreadContext<'_, Rn, Input, Output, Accum>
Auto Trait Implementations§
impl<'env, Rn, Input, Output, Accum> Freeze for ThreadContext<'env, Rn, Input, Output, Accum>
impl<'env, Rn, Input, Output, Accum> RefUnwindSafe for ThreadContext<'env, Rn, Input, Output, Accum>
impl<'env, Rn, Input, Output, Accum> Send for ThreadContext<'env, Rn, Input, Output, Accum>
impl<'env, Rn, Input, Output, Accum> Sync for ThreadContext<'env, Rn, Input, Output, Accum>
impl<'env, Rn, Input, Output, Accum> Unpin for ThreadContext<'env, Rn, Input, Output, Accum>
impl<'env, Rn, Input, Output, Accum> UnwindSafe for ThreadContext<'env, Rn, Input, Output, Accum>
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