Trait tokio_schedule::Job[][src]

pub trait Job: Sized + Sync {
    type TZ: TimeZone + Send + Sync;
    fn time_to_sleep_at(&self, now: &DateTime<Self::TZ>) -> Duration;

    fn time_to_sleep(&self) -> Duration { ... }
fn perform<'a, F, Fut>(
        self,
        func: F
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
    where
        Self: Send + 'a,
        F: FnMut() -> Fut + Send + 'a,
        Fut: Future<Output = ()> + Send + 'a,
        <Self::TZ as TimeZone>::Offset: Send + 'a
, { ... } }

This Trait represents job in timezone. It provides method perform.

Associated Types

Loading content...

Required methods

fn time_to_sleep_at(&self, now: &DateTime<Self::TZ>) -> Duration[src]

This method acts like time_to_sleep but with custom reference time

Loading content...

Provided methods

fn time_to_sleep(&self) -> Duration[src]

This method returns Duration from now to next job run

fn perform<'a, F, Fut>(
    self,
    func: F
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>> where
    Self: Send + 'a,
    F: FnMut() -> Fut + Send + 'a,
    Fut: Future<Output = ()> + Send + 'a,
    <Self::TZ as TimeZone>::Offset: Send + 'a, 
[src]

This method returns Future that cyclic performs the job

Loading content...

Implementors

impl<TZ> Job for EveryDay<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryDayAt<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryHour<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryHourAt<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryMinute<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryMinuteAt<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EverySecond<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryWeekDay<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

impl<TZ> Job for EveryWeekDayAt<TZ> where
    TZ: Clone + TimeZone + Send + Sync
[src]

type TZ = TZ

fn time_to_sleep_at(&self, now: &DateTime<TZ>) -> Duration[src]

fn timezone(&self) -> &Self::TZ[src]

Loading content...