pub struct WorkerBuilder<Req, Ctx, Source, Middleware, Serv> { /* private fields */ }
Expand description
Allows building a Worker
.
Usually the output is Worker<Ready>
Implementations§
Source§impl<Serv> WorkerBuilder<(), (), (), Identity, Serv>
impl<Serv> WorkerBuilder<(), (), (), Identity, Serv>
Sourcepub fn new<T: AsRef<str>>(name: T) -> WorkerBuilder<(), (), (), Identity, Serv>
pub fn new<T: AsRef<str>>(name: T) -> WorkerBuilder<(), (), (), Identity, Serv>
Build a new WorkerBuilder
instance with a name for the worker to build
Source§impl<M, Serv> WorkerBuilder<(), (), (), M, Serv>
impl<M, Serv> WorkerBuilder<(), (), (), M, Serv>
Source§impl<Req, M, Serv, Ctx> WorkerBuilder<Req, Ctx, (), M, Serv>
impl<Req, M, Serv, Ctx> WorkerBuilder<Req, Ctx, (), M, Serv>
Sourcepub fn chain<NewLayer>(
self,
f: impl FnOnce(ServiceBuilder<M>) -> ServiceBuilder<NewLayer>,
) -> WorkerBuilder<Req, Ctx, (), NewLayer, Serv>
pub fn chain<NewLayer>( self, f: impl FnOnce(ServiceBuilder<M>) -> ServiceBuilder<NewLayer>, ) -> WorkerBuilder<Req, Ctx, (), NewLayer, Serv>
Allows of decorating the service that consumes jobs.
Allows adding multiple tower
middleware
Trait Implementations§
Source§impl<Req, Ctx, Source, Middleware, Serv> Debug for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
impl<Req, Ctx, Source, Middleware, Serv> Debug for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
Source§impl<Req, P, M, Ctx, Input, Compact, Output, Index> StepWorkerFactory<Ctx, Compact, Input, Output, Index> for WorkerBuilder<Req, Ctx, P, M, StepService<Ctx, Compact, Input, P, Index>>where
Compact: Send + 'static + Sync,
P: Backend<Request<StepRequest<Compact, Index>, Ctx>> + 'static + Storage<Job = StepRequest<Compact, Index>> + Clone,
M: Layer<StepService<Ctx, Compact, Input, P, Index>> + 'static,
impl<Req, P, M, Ctx, Input, Compact, Output, Index> StepWorkerFactory<Ctx, Compact, Input, Output, Index> for WorkerBuilder<Req, Ctx, P, M, StepService<Ctx, Compact, Input, P, Index>>where
Compact: Send + 'static + Sync,
P: Backend<Request<StepRequest<Compact, Index>, Ctx>> + 'static + Storage<Job = StepRequest<Compact, Index>> + Clone,
M: Layer<StepService<Ctx, Compact, Input, P, Index>> + 'static,
Source§type Service = <M as Layer<StepService<Ctx, Compact, Input, P, Index>>>::Service
type Service = <M as Layer<StepService<Ctx, Compact, Input, P, Index>>>::Service
The service that the worker will run jobs against
Source§type Codec = <P as Backend<Request<StepRequest<Compact, Index>, Ctx>>>::Codec
type Codec = <P as Backend<Request<StepRequest<Compact, Index>, Ctx>>>::Codec
Represents the codec for the backend bound
Source§fn build_stepped(
self,
builder: StepBuilder<Ctx, Compact, Input, Output, Self::Codec, Index>,
) -> Worker<Ready<M::Service, P>>
fn build_stepped( self, builder: StepBuilder<Ctx, Compact, Input, Output, Self::Codec, Index>, ) -> Worker<Ready<M::Service, P>>
Builds a
StepWorkerFactory
using a tower
service
that can be used to generate a new Worker
using the build_stepped
method Read moreSource§impl<Req, P, M, S, Ctx> WorkerFactory<Req, Ctx, S> for WorkerBuilder<Req, Ctx, P, M, S>
impl<Req, P, M, S, Ctx> WorkerFactory<Req, Ctx, S> for WorkerBuilder<Req, Ctx, P, M, S>
Auto Trait Implementations§
impl<Req, Ctx, Source, Middleware, Serv> Freeze for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
impl<Req, Ctx, Source, Middleware, Serv> !RefUnwindSafe for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
impl<Req, Ctx, Source, Middleware, Serv> Send for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
impl<Req, Ctx, Source, Middleware, Serv> Sync for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
impl<Req, Ctx, Source, Middleware, Serv> Unpin for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
impl<Req, Ctx, Source, Middleware, Serv> !UnwindSafe for WorkerBuilder<Req, Ctx, Source, Middleware, Serv>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Req, W, F, Ctx, FnArgs> WorkerFactoryFn<Req, Ctx, F, FnArgs> for Wwhere
W: WorkerFactory<Req, Ctx, ServiceFn<F, Req, Ctx, FnArgs>>,
impl<Req, W, F, Ctx, FnArgs> WorkerFactoryFn<Req, Ctx, F, FnArgs> for Wwhere
W: WorkerFactory<Req, Ctx, ServiceFn<F, Req, Ctx, FnArgs>>,
Source§type Source = <W as WorkerFactory<Req, Ctx, ServiceFn<F, Req, Ctx, FnArgs>>>::Source
type Source = <W as WorkerFactory<Req, Ctx, ServiceFn<F, Req, Ctx, FnArgs>>>::Source
The request source for the
Worker
Source§type Service = <W as WorkerFactory<Req, Ctx, ServiceFn<F, Req, Ctx, FnArgs>>>::Service
type Service = <W as WorkerFactory<Req, Ctx, ServiceFn<F, Req, Ctx, FnArgs>>>::Service
The service that the worker will run jobs against
Source§fn build_fn(
self,
f: F,
) -> Worker<Ready<<W as WorkerFactoryFn<Req, Ctx, F, FnArgs>>::Service, <W as WorkerFactoryFn<Req, Ctx, F, FnArgs>>::Source>>
fn build_fn( self, f: F, ) -> Worker<Ready<<W as WorkerFactoryFn<Req, Ctx, F, FnArgs>>::Service, <W as WorkerFactoryFn<Req, Ctx, F, FnArgs>>::Source>>
Builds a
WorkerFactoryFn
using ServiceFn
that can be used to generate new Worker
using the build_fn
method Read more