[][src]Attribute Macro coil_proc_macro::background_job

#[background_job]

The attribute macro for creating background jobs.

Examples

This example is not tested
// I cant be asynchronous because I'll block the executor
#[background_job]
fn perform_heavy_computation(foo: HeavyComputation) -> Result<(), PerformError> {
    foo.compute()?;
    Ok(())
}
This example is not tested
#[background_job]
async fn crawl_for_new_info(website: Website) -> Result<(), PerformError> {
    let content = website.get_content().await?;
    content.modify().send_to_actor_pipeline();
}