Skip to main content

impl_worker

Macro impl_worker 

Source
macro_rules! impl_worker {
    ($worker:ty, $error:ty => $run_body:block) => { ... };
}
Expand description

Implement the Worker trait with minimal boilerplate for the run method only

ยงExamples

use ash_flare::impl_worker;
use std::time::Duration;

struct MyWorker;

impl_worker! {
    MyWorker, std::io::Error => {
        // do work
        tokio::time::sleep(Duration::from_millis(1)).await;
        Ok(())
    }
}