pub struct PeriodicJob {
pub name: String,
pub cron_expr: String,
pub timezone: String,
pub kind: String,
pub queue: String,
pub args: Value,
pub priority: i16,
pub max_attempts: i16,
pub tags: Vec<String>,
pub metadata: Value,
}Expand description
A periodic job schedule definition.
Created via PeriodicJob::builder(name, cron_expr).build(args).
Fields§
§name: StringUnique name identifying this schedule (e.g., “daily_report”).
cron_expr: StringCron expression (e.g., “0 9 * * *”).
timezone: StringIANA timezone (e.g., “Pacific/Auckland”). Defaults to “UTC”.
kind: StringJob kind (derived from JobArgs trait).
queue: StringTarget queue. Defaults to “default”.
args: ValueSerialized job arguments.
priority: i16Job priority (1-4). Defaults to 2.
max_attempts: i16Max retry attempts. Defaults to 25.
Tags attached to created jobs.
metadata: ValueExtra metadata merged into created jobs.
Implementations§
Source§impl PeriodicJob
impl PeriodicJob
Sourcepub fn builder(
name: impl Into<String>,
cron_expr: impl Into<String>,
) -> PeriodicJobBuilder
pub fn builder( name: impl Into<String>, cron_expr: impl Into<String>, ) -> PeriodicJobBuilder
Start building a periodic job with a name and cron expression.
The cron expression is validated eagerly — invalid expressions
cause build() to return an error.
Sourcepub fn latest_fire_time(
&self,
now: DateTime<Utc>,
after: Option<DateTime<Utc>>,
) -> Option<DateTime<Utc>>
pub fn latest_fire_time( &self, now: DateTime<Utc>, after: Option<DateTime<Utc>>, ) -> Option<DateTime<Utc>>
Compute the latest fire time <= now that is strictly after after.
Returns None if no fire time exists in the range (after, now].
This handles both “first registration” (after=None → find latest past fire)
and “regular evaluation” (after=Some(last_enqueued_at)).
Trait Implementations§
Source§impl Clone for PeriodicJob
impl Clone for PeriodicJob
Source§fn clone(&self) -> PeriodicJob
fn clone(&self) -> PeriodicJob
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PeriodicJob
impl RefUnwindSafe for PeriodicJob
impl Send for PeriodicJob
impl Sync for PeriodicJob
impl Unpin for PeriodicJob
impl UnsafeUnpin for PeriodicJob
impl UnwindSafe for PeriodicJob
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
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>
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>
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