Skip to main content

ScheduledEvent

Struct ScheduledEvent 

Source
pub struct ScheduledEvent { /* private fields */ }
Expand description

One entry in a schedule.

Implementations§

Source§

impl ScheduledEvent

Source

pub fn name(&self) -> &str

What this event is called in logs and in a TickReport.

Source

pub fn expression(&self) -> String

The cron expression this event has been narrowed to so far.

Source

pub fn cron(&mut self, expression: &str) -> &mut Self

Set the whole expression at once.

Source

pub fn every_minute(&mut self) -> &mut Self

Every minute. The default, spelled out.

Source

pub fn every_minutes(&mut self, n: u32) -> &mut Self

Every n minutes, from the top of the hour.

Source

pub fn hourly(&mut self) -> &mut Self

On the hour, every hour.

Source

pub fn daily(&mut self) -> &mut Self

Once a day at midnight. Narrow it with ScheduledEvent::at.

Source

pub fn weekly_on(&mut self, day: Weekday, time: &str) -> &mut Self

Once a week, on a day and at a time. Times are UTC.

Source

pub fn monthly(&mut self) -> &mut Self

Once a month, on the first, at midnight.

Source

pub fn at(&mut self, time: &str) -> &mut Self

The time of day, as HH:MM.

Sets the hour and minute fields, so daily().at("13:00") means one run a day at one in the afternoon, UTC.

Source

pub fn without_overlapping(&mut self) -> &mut Self

Skip a run when the previous one is still going.

A task that takes six minutes on a five-minute schedule would otherwise pile up until the process falls over. The lock is a flag in this process — good enough for the scheduler, which is meant to be run once, not once per node.

Source

pub fn is_running(&self) -> bool

True while a run of this event is in flight.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.