[][src]Struct async_jobs::Scheduler

pub struct Scheduler(_);

Schedules execution of jobs and dependencies

Uses the builder pattern to configure various aspects of job execution.

use async_jobs::{Job, Outcome, Scheduler};
use async_trait::async_trait;

#[derive(PartialEq)]
struct MyJob(String);

#[async_trait]
impl Job for MyJob {

    type Error = ();

    async fn run(&self) -> Result<Outcome, Self::Error> {
        println!("message: {}", self.0);
        Ok(Outcome::Success)
    }

    fn dependencies(&self) -> Vec<Self> { vec![] }
}

Scheduler::default()
    .run(MyJob("hello, world".into()));

Implementations

impl Scheduler[src]

pub async fn run<J: Job, '_>(&'_ self, job: J) -> Result<(), Error<J::Error>>[src]

Executes job and its dependencies

Trait Implementations

impl Default for Scheduler[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.