[][src]Trait coil::Job

pub trait Job: Serialize + DeserializeOwned {
    type Environment: 'static + Send + Sync;

    const JOB_TYPE: &'static str;
#[must_use]    fn enqueue<'a, 'async_trait, C>(
        self,
        conn: C
    ) -> Pin<Box<dyn Future<Output = Result<(), EnqueueError>> + Send + 'async_trait>>
    where
        C: Executor<'a, Database = Postgres>,
        'a: 'async_trait,
        C: 'async_trait,
        Self: Send + 'async_trait
, { ... } }

Background job

Associated Types

type Environment: 'static + Send + Sync

The environment this job is run with. This is a struct you define, which should encapsulate things like database connection pools, any configuration, and any other static data or shared resources.

Loading content...

Associated Constants

const JOB_TYPE: &'static str

The key to use for storing this job. Typically this is the name of your struct in snake_case.

Loading content...

Provided methods

#[must_use]fn enqueue<'a, 'async_trait, C>(
    self,
    conn: C
) -> Pin<Box<dyn Future<Output = Result<(), EnqueueError>> + Send + 'async_trait>> where
    C: Executor<'a, Database = Postgres>,
    'a: 'async_trait,
    C: 'async_trait,
    Self: Send + 'async_trait, 

inserts the job into the Postgres Database

Loading content...

Implementors

Loading content...