-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Have you considered representing tasks by structs of their context instead of functions? This way we could avoid explicit context deserialization and related bugs. E.g. this would be impossible:
struct Foo;
struct Bar;
#[job]
pub async fn foo(job: CurrentJob) -> Result<..> {
let context: Foo = job.json()?;
}
foo.builder().set_json(&Bar).spawn(&db).await?;It would be something like:
#[derive(Job)]
struct MyJob;
impl CurrentJob for MyJob {
fn run(self) -> Result<..> {
}
}
MyJob { ... }.spawn(&db).await?;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels