pub trait WithStorage<NS, ST: Storage<Output = Self::Job>>: Sized {
    type Job;
    type Stream;

    // Required method
    fn with_storage_config(
        self,
        storage: ST,
        config: impl Fn(WorkerConfig) -> WorkerConfig
    ) -> WorkerBuilder<Self::Job, Self::Stream, NS>;

    // Provided method
    fn with_storage(
        self,
        storage: ST
    ) -> WorkerBuilder<Self::Job, Self::Stream, NS> { ... }
}
Available on crate feature storage only.
Expand description

A helper trait to help build a WorkerBuilder that consumes a Storage

Required Associated Types§

source

type Job

The job to consume

source

type Stream

The source of jobs

Required Methods§

source

fn with_storage_config( self, storage: ST, config: impl Fn(WorkerConfig) -> WorkerConfig ) -> WorkerBuilder<Self::Job, Self::Stream, NS>

The builder method to produce a configured WorkerBuilder that will consume jobs

Provided Methods§

source

fn with_storage(self, storage: ST) -> WorkerBuilder<Self::Job, Self::Stream, NS>

The builder method to produce a default WorkerBuilder that will consume jobs

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<J: 'static + Send + Sync, M, ST> WithStorage<Stack<Extension<ST>, Stack<AckLayer<ST, J>, M>>, ST> for WorkerBuilder<(), (), M>where ST: Storage<Output = J> + Send + Sync + 'static, M: Send + Sync + 'static,

§

type Job = J

§

type Stream = Pin<Box<dyn Stream<Item = Result<Option<JobRequest<J>>, JobStreamError>> + Send>>