#![allow(clippy::field_reassign_with_default)]
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_with;
pub mod aj;
pub mod backend;
pub mod error;
pub mod job;
pub mod plugin;
pub mod queue;
pub mod util;
pub use aj::*;
pub use backend::*;
pub use error::*;
pub use job::*;
pub use plugin::*;
pub use queue::*;
pub use util::*;
pub use async_trait;
pub use chrono;
pub use cron;
pub use serde;
use serde::{de::DeserializeOwned, Serialize};
impl<M> Job<M>
where
M: BackgroundJob
+ Executable
+ Unpin
+ Send
+ Sync
+ Clone
+ Serialize
+ DeserializeOwned
+ 'static,
{
pub async fn run(self) -> Result<String, Error> {
AJ::add_job(self, M::queue_name()).await
}
pub fn just_run(self) {
if let Some(aj_ref) = get_aj_address() {
let job = self;
let queue_name = M::queue_name().to_string();
tokio::spawn(async move {
let _ = aj_ref.tell(JustRunJob { job, queue_name }).await;
});
}
}
}