[][src]Struct coil::Builder

pub struct Builder<Env> { /* fields omitted */ }

Builder pattern struct for the Runner

Implementations

impl<Env: 'static> Builder<Env>[src]

pub fn new(env: Env, executor: impl Spawn + 'static, pg_pool: PgPool) -> Self[src]

Instantiate a new instance of the Builder

pub fn register_job<T: Job + 'static + Send>(self) -> Self[src]

Register a job that hasn't or can't be registered by invoking the register_job! macro

Jobs that include generics must use this function in order to be registered with a runner. Jobs must be registered with every generic that is used. Jobs are available in the format my_function_name::Job.

Example

This example is not tested
RunnerBuilder::new(env, executor, conn)
    .register_job::<resize_image::Job<String>>()

Different jobs must be registered with different generics if they exist.

This example is not tested
RunnerBuilder::new((), executor, conn)
   .register_job::<resize_image::Job<String>>()
   .register_job::<resize_image::Job<u32>>()
   .register_job::<resize_image::Job<MyStruct>()

pub fn num_threads(self, threads: usize) -> Self[src]

specify the amount of threads to run the threadpool with

pub fn max_tasks(self, max_tasks: usize) -> Self[src]

Specify the maximum tasks to queue in the threadpool at any given time

pub fn on_finish(self, on_finish: impl Fn(i64) + Send + Sync + 'static) -> Self[src]

Provide a hook that runs after a job has finished and all destructors have run the on_finish closure accepts the job ID that finished as an argument

pub fn timeout(self, timeout: Duration) -> Self[src]

Set a timeout in seconds. This timeout is the maximum amount of time coil will wait for a job to begin before returning an error.

pub fn build(self) -> Result<Runner<Env>, Error>[src]

Build the runner

Auto Trait Implementations

impl<Env> !RefUnwindSafe for Builder<Env>

impl<Env> !Send for Builder<Env>

impl<Env> !Sync for Builder<Env>

impl<Env> Unpin for Builder<Env> where
    Env: Unpin

impl<Env> !UnwindSafe for Builder<Env>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,