pub struct NewJob { /* private fields */ }Expand description
A job to queue: its type, its arguments, and when and how it runs.
Implementations§
Source§impl NewJob
impl NewJob
Sourcepub fn new(name: impl Into<String>, args: Value) -> Self
pub fn new(name: impl Into<String>, args: Value) -> Self
A job for the handler named name, ready now, with the queue’s limit on
tries and priority zero.
Sourcepub fn tenant(self, tenant: impl Into<String>) -> Self
pub fn tenant(self, tenant: impl Into<String>) -> Self
Run this job for tenant, the id an auth crate’s Tenant gives, which its
handler receives beside the arguments, so that it can open its own tenant
transaction. Only a handler registered with Queue::handle_with_tenant runs
it. Enqueuing refuses an id that is not a tenant id, with
Error::NotATenant.
Sourcepub const fn timeout(self, limit: Duration) -> Self
pub const fn timeout(self, limit: Duration) -> Self
Stop a run of this job past limit, and count it as failed with the reason.
A job has no time limit unless it is given one.
Sourcepub const fn max_attempts(self, max_attempts: Option<i32>) -> Self
pub const fn max_attempts(self, max_attempts: Option<i32>) -> Self
Tries this job gets, including the first, or the queue’s when None.
Sourcepub const fn priority(self, priority: i16) -> Self
pub const fn priority(self, priority: i16) -> Self
Run ahead of ready jobs with a lower priority. Zero by default, and may be negative.
Trait Implementations§
Auto Trait Implementations§
impl Forget for NewJob
impl Freeze for NewJob
impl Move for NewJob
impl RefUnwindSafe for NewJob
impl Send for NewJob
impl Sync for NewJob
impl Unpin for NewJob
impl UnsafeUnpin for NewJob
impl UnwindSafe for NewJob
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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