Skip to main content

ScheduleRule

Enum ScheduleRule 

Source
pub enum ScheduleRule {
    Minutely {
        every: u32,
    },
    Hourly {
        every: u32,
    },
    Daily {
        every: u32,
    },
    Weekly {
        every: u32,
        weekdays: Vec<Weekday>,
    },
    Monthly {
        every: u32,
        day: u32,
    },
    Yearly {
        every: u32,
        month: u32,
        day: u32,
    },
}
Expand description

A recurrence rule evaluated in a schedule’s local timezone.

§Rule families

The rule variants fall into two broad groups:

§Anchoring semantics

Recurrence rules must have stable phase semantics so that querying at different times does not redefine the schedule.

This implementation uses the following anchors:

  • Minutely { every }: occurrences happen at local times whose minute satisfies minute % every == 0, with seconds and subseconds taken from at.
  • Hourly { every }: occurrences happen at local times whose hour satisfies hour % every == 0, with minute/second/subsecond taken from at.
  • Daily { every }: anchored to the fixed local date 1970-01-01.
  • Weekly { every, ... }: anchored to the Monday of the week containing 1970-01-01.
  • Monthly { every, day }: anchored to January 1970.
  • Yearly { every, month, day }: anchored to the calendar year 1970.

These anchors provide stable recurrence phase across calls to WindowSource::next_window and WindowSource::active_windows.

Variants§

§

Minutely

Recur every every minutes within each hour.

For example, Minutely { every: 15 } with at = 00:00:30 produces local times such as:

  • 00:00:30
  • 00:15:30
  • 00:30:30
  • 00:45:30
  • 01:00:30

and so on.

Fields

§every: u32
§

Hourly

Recur every every hours within each day.

For example, Hourly { every: 6 } with at = 00:10:00 produces local times such as:

  • 00:10:00
  • 06:10:00
  • 12:10:00
  • 18:10:00
  • next day 00:10:00

and so on.

Fields

§every: u32
§

Daily

Recur every every days, anchored to 1970-01-01.

Fields

§every: u32
§

Weekly

Recur every every weeks on the specified weekdays, anchored to the Monday of the week containing 1970-01-01.

Fields

§every: u32
§weekdays: Vec<Weekday>
§

Monthly

Recur every every months on a specific day-of-month.

Months that do not contain day are skipped.

Fields

§every: u32
§day: u32
§

Yearly

Recur every every years on a specific month/day.

Impossible dates such as February 30 are rejected during construction.

Fields

§every: u32
§month: u32
§day: u32

Trait Implementations§

Source§

impl Clone for ScheduleRule

Source§

fn clone(&self) -> ScheduleRule

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScheduleRule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ScheduleRule

Source§

fn eq(&self, other: &ScheduleRule) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ScheduleRule

Source§

impl StructuralPartialEq for ScheduleRule

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.