pub struct WorkerHandle { /* private fields */ }Expand description
A handle to the worker task.
Used for shutting down the worker and waiting for it to finish.
Implementations§
Source§impl WorkerHandle
impl WorkerHandle
Sourcepub async fn shut_down(&self)
pub async fn shut_down(&self)
Signal the worker to shut down after processing any in-flight batches.
New items are still accepted while shutting down, and the worker only shuts down once all keys are idle. This means shutdown may never complete if:
- new items keep being added, or
- a batch never meets its policy’s processing condition, e.g. when using the
Sizepolicy, a final partial batch may wait indefinitely for more items.
Stopping the flow of new items is expected to be handled by the caller, e.g. by shutting down the message handlers which add items before shutting down the batcher.
Sourcepub async fn wait_for_shutdown(&self)
pub async fn wait_for_shutdown(&self)
Wait for the worker to finish.
Trait Implementations§
Source§impl Clone for WorkerHandle
impl Clone for WorkerHandle
Source§fn clone(&self) -> WorkerHandle
fn clone(&self) -> WorkerHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkerHandle
impl RefUnwindSafe for WorkerHandle
impl Send for WorkerHandle
impl Sync for WorkerHandle
impl Unpin for WorkerHandle
impl UnsafeUnpin for WorkerHandle
impl UnwindSafe for WorkerHandle
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