Struct pawawwewism::WorkerSetBuilder
source · pub struct WorkerSetBuilder { /* private fields */ }
Expand description
A builder object that can be used to configure and spawn a WorkerSet
.
Implementations§
source§impl WorkerSetBuilder
impl WorkerSetBuilder
sourcepub fn name<N: Into<String>>(self, name: N) -> Self
pub fn name<N: Into<String>>(self, name: N) -> Self
Sets the base name of the WorkerSet
threads.
Each thread spawned will be named according to this base name and its index.
sourcepub fn spawn<I, F>(self, count: usize, handler: F) -> Result<WorkerSet<I>>where
I: Send + 'static,
F: Fn(I) + Send + Sync + 'static,
pub fn spawn<I, F>(self, count: usize, handler: F) -> Result<WorkerSet<I>>where I: Send + 'static, F: Fn(I) + Send + Sync + 'static,
Spawns a WorkerSet
that uses handler
to process incoming messages.
Unlike WorkerBuilder::spawn
, this method requires handler
to implement Fn
(not
just FnMut
), because it is shared across all threads in the set, and may execute several
times at once.
Panics
This method will panic if count
is 0.
Auto Trait Implementations§
impl RefUnwindSafe for WorkerSetBuilder
impl Send for WorkerSetBuilder
impl Sync for WorkerSetBuilder
impl Unpin for WorkerSetBuilder
impl UnwindSafe for WorkerSetBuilder
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