Skip to main content

Scheduler

Trait Scheduler 

Source
pub trait Scheduler: Send + Sync {
    // Required methods
    fn schedule(&self, job: Job) -> Result<()>;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
        await_termination: bool,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn schedule_with_completion(&self, job: Job, completion: Job) -> Result<()> { ... }
}
Expand description

Scheduler defines a set of API to schedule Jobs

Required Methods§

Source

fn schedule(&self, job: Job) -> Result<()>

Schedules a Job

Source

fn stop<'life0, 'async_trait>( &'life0 self, await_termination: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stops scheduler. If await_termination is set to true, the scheduler will wait until all tasks are processed.

Provided Methods§

Source

fn schedule_with_completion(&self, job: Job, completion: Job) -> Result<()>

Runs completion only after the job and its owned resources have been dropped.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§