pub struct Schedule { /* private fields */ }Expand description
A job queued every interval, or at the times a cron pattern names. See Schedules.
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub fn every(
name: impl Into<String>,
interval: Duration,
job: NewJob,
) -> Result<Self>
pub fn every( name: impl Into<String>, interval: Duration, job: NewJob, ) -> Result<Self>
Queue job every interval, under the schedule name name. The name keys
its row, so keep it stable across releases. A delay set on job is ignored.
§Errors
Error::Schedule when the name is empty or over 200 characters, or the
interval is under a second: these are mistakes in code, found at boot.
Sourcepub fn cron(name: impl Into<String>, pattern: &str, job: NewJob) -> Result<Self>
pub fn cron(name: impl Into<String>, pattern: &str, job: NewJob) -> Result<Self>
Queue job at each time the cron pattern names, in UTC on the database’s
clock, under the schedule name name. The pattern has five fields, minute to
day of week, or six with seconds first, as croner reads them: "0 2 * * *" is
02:00 each day, and "0 9 * * MON-FRI" 09:00 each weekday. A delay set on job
is ignored. The first time is the pattern’s next after the row is made.
§Errors
Error::Schedule when the name is empty or over 200 characters, or the
pattern does not parse or names no time to come: these are mistakes in code,
found at boot.
Sourcepub const fn first_at(self, first: Timestamp) -> Self
pub const fn first_at(self, first: Timestamp) -> Self
The first due time, used only when the schedule’s row is made. With an interval of 24 hours and a first time at 02:00 UTC, the job runs at 02:00 each day. Without one, the first is as soon as the row is made. A cron schedule’s first time is its pattern’s, and it ignores this.
Sourcepub fn interval(&self) -> Option<Duration>
pub fn interval(&self) -> Option<Duration>
The schedule’s interval, or None for a cron schedule.
Sourcepub fn cron_pattern(&self) -> Option<&str>
pub fn cron_pattern(&self) -> Option<&str>
The schedule’s cron pattern, or None for one every interval.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Schedule
impl Freeze for Schedule
impl Move for Schedule
impl RefUnwindSafe for Schedule
impl Send for Schedule
impl Sync for Schedule
impl Unpin for Schedule
impl UnsafeUnpin for Schedule
impl UnwindSafe for Schedule
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