Skip to content

Instantly share code, notes, and snippets.

@zupzup

zupzup/some_file.rs

Created Mar 18, 2020
Embed
What would you like to do?
some_gist
#[derive(Clone)]
pub struct JobContext {
pub db_pool: DBPool,
pub redis_pool: RedisPool,
}
pub trait Job {
fn run(&self, ctx: &JobContext) -> JobResult;
fn get_interval(&self) -> Duration;
fn get_name(&self) -> &'static str;
fn get_sync_key(&self) -> &'static str;
fn box_clone(&self) -> BoxedJob;
}
impl Clone for Box<dyn Job> {
fn clone(&self) -> Box<dyn Job> {
self.box_clone()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.