2022-08-29 16:59:22 +00:00
|
|
|
use crate::queue::Queueable;
|
2022-08-31 17:45:13 +00:00
|
|
|
use crate::FangError;
|
2022-08-29 16:59:22 +00:00
|
|
|
use crate::Scheduled;
|
|
|
|
|
|
|
|
pub const COMMON_TYPE: &str = "common";
|
|
|
|
|
|
|
|
#[typetag::serde(tag = "type")]
|
|
|
|
pub trait Runnable {
|
2022-08-31 17:45:13 +00:00
|
|
|
fn run(&self, _queueable: &dyn Queueable) -> Result<(), FangError>;
|
2022-08-29 16:59:22 +00:00
|
|
|
|
|
|
|
fn task_type(&self) -> String {
|
|
|
|
COMMON_TYPE.to_string()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn uniq(&self) -> bool {
|
|
|
|
false
|
|
|
|
}
|
|
|
|
|
|
|
|
fn cron(&self) -> Option<Scheduled> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|