Scheduler

Trait Scheduler 

Source
pub trait Scheduler:
    Debug
    + DeserializeOwned
    + Serialize
    + Sized
    + Sync {
    // Provided methods
    fn enqueue<'e, 'life0, 'async_trait>(
        &'life0 self,
        db: impl 'async_trait + PgExecutor<'e>,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'e: 'async_trait,
             'life0: 'async_trait { ... }
    fn delay<'e, 'life0, 'async_trait>(
        &'life0 self,
        db: impl 'async_trait + PgExecutor<'e>,
        delay: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'e: 'async_trait,
             'life0: 'async_trait { ... }
    fn schedule<'e, 'life0, 'async_trait>(
        &'life0 self,
        db: impl 'async_trait + PgExecutor<'e>,
        at: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'e: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A tait to implement on the outer enum wrapper containing all the tasks

Provided Methods§

Source

fn enqueue<'e, 'life0, 'async_trait>( &'life0 self, db: impl 'async_trait + PgExecutor<'e>, ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
where Self: 'async_trait, 'e: 'async_trait, 'life0: 'async_trait,

Enqueues the task to be run immediately

Source

fn delay<'e, 'life0, 'async_trait>( &'life0 self, db: impl 'async_trait + PgExecutor<'e>, delay: Duration, ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
where Self: 'async_trait, 'e: 'async_trait, 'life0: 'async_trait,

Schedules a task to be run after a specified delay

Source

fn schedule<'e, 'life0, 'async_trait>( &'life0 self, db: impl 'async_trait + PgExecutor<'e>, at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
where Self: 'async_trait, 'e: 'async_trait, 'life0: 'async_trait,

Schedules a task to run at a specified time in the future

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§