Trait tokio_schedule::Job[][src]

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

    fn time_to_sleep(&self) -> Option<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
, { ... } }
Expand description

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

Associated Types

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

Provided methods

fn time_to_sleep(&self) -> Option<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

Implementors

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

type TZ = TZ

type UntilTZ = UntilTZ

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

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

fn get_until(&self) -> Option<&DateTime<Self::UntilTZ>>[src]

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

type TZ = TZ

type UntilTZ = UntilTZ

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

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

fn get_until(&self) -> Option<&DateTime<UntilTZ>>[src]

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

type TZ = TZ

type UntilTZ = UntilTZ

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

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

fn get_until(&self) -> Option<&DateTime<Self::UntilTZ>>[src]

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

type TZ = TZ

type UntilTZ = UntilTZ

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

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

fn get_until(&self) -> Option<&DateTime<Self::UntilTZ>>[src]

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

type TZ = TZ

type UntilTZ = UntilTZ

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

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

fn get_until(&self) -> Option<&DateTime<Self::UntilTZ>>[src]