pub struct WorkerPool<Q: Queue + 'static> { /* private fields */ }Expand description
A pool of workers consuming jobs from a Queue.
Implementations§
Source§impl<Q: Queue + 'static> WorkerPool<Q>
impl<Q: Queue + 'static> WorkerPool<Q>
Sourcepub fn new(queue: Q, concurrency: usize) -> Self
pub fn new(queue: Q, concurrency: usize) -> Self
Creates a new worker pool with the given concurrency.
Sourcepub fn with_config(queue: Q, config: WorkerConfig) -> Self
pub fn with_config(queue: Q, config: WorkerConfig) -> Self
Creates a new worker pool with explicit configuration.
Sourcepub fn start<H>(&self, topic: &str, handler: H)where
H: JobHandler + 'static,
pub fn start<H>(&self, topic: &str, handler: H)where
H: JobHandler + 'static,
Starts concurrency workers consuming from topic.
Auto Trait Implementations§
impl<Q> Freeze for WorkerPool<Q>
impl<Q> RefUnwindSafe for WorkerPool<Q>where
Arc<Q>: RefUnwindSafe,
impl<Q> Send for WorkerPool<Q>
impl<Q> Sync for WorkerPool<Q>
impl<Q> Unpin for WorkerPool<Q>
impl<Q> UnsafeUnpin for WorkerPool<Q>where
Arc<Q>: UnsafeUnpin,
impl<Q> UnwindSafe for WorkerPool<Q>where
Arc<Q>: 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