pub struct Worker { /* private fields */ }Expand description
A worker that processes tasks from the queue.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn subscribed_types(&self) -> Vec<String>
pub fn subscribed_types(&self) -> Vec<String>
Returns the task types this worker is subscribed to.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Returns whether the worker is running.
Sourcepub async fn process_one(&self, cx: &Cx) -> DocketResult<bool>
pub async fn process_one(&self, cx: &Cx) -> DocketResult<bool>
Processes a single task if available.
Returns true if a task was processed, false if no task was available.
Sourcepub async fn run(&self, cx: &Cx) -> DocketResult<()>
pub async fn run(&self, cx: &Cx) -> DocketResult<()>
Runs the worker loop until stopped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Worker
impl !RefUnwindSafe for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl !UnwindSafe for Worker
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).