Skip to content

SubconsciousCompute/job-dispatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

job-dispatcher

Crates.io docs.rs

Rust crate to execute jobs/tasks in an async way

Example:-

use job_dispatcher::job::Job;

#[tokio::main]
async fn main() {
    let path = "C:\\Users\\sn99\\Downloads\\privacy-script.bat";

    let mut job = Job::new("trash", path);

    // start a job
    job.start();

    // check is the job is done (does not block)
    println!("Job done?: {:?}", job.try_wait());

    // wait for it to finish (will block), will error out if previous statement returns `Ok`, use `match` to handle them
    job.wait().await.expect("Job failed");

    println!("Job exited with code: {:?}", job.get_status());
}

LICENSE

Contribution

MIT licensed. Contributions are welcome!

About

Rust crate to execute jobs/tasks in an async way

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages