pub struct WorkerLayer<T> { /* private fields */ }Expand description
Layer that spawns a provided worker task using a closure that accepts a clone of the service and then passes through the wrapped service. Spawns a worker task with a clone of the inner service.
The default Tokio executor is used to run the given service, which means that this layer can only be used on the Tokio runtime.
See the module documentation for more details.
Implementations§
Source§impl<T> WorkerLayer<T>
impl<T> WorkerLayer<T>
Sourcepub fn new(make_worker: T) -> Self
pub fn new(make_worker: T) -> Self
Creates a new WorkerLayer with the provided make_worker closure.
make_worker accepts a clone of the inner service and returns a
Future that will be spawned as a tokio task.
Trait Implementations§
Source§impl<S, T, F> Layer<S> for WorkerLayer<T>
impl<S, T, F> Layer<S> for WorkerLayer<T>
Auto Trait Implementations§
impl<T> Freeze for WorkerLayer<T>where
T: Freeze,
impl<T> RefUnwindSafe for WorkerLayer<T>where
T: RefUnwindSafe,
impl<T> Send for WorkerLayer<T>where
T: Send,
impl<T> Sync for WorkerLayer<T>where
T: Sync,
impl<T> Unpin for WorkerLayer<T>where
T: Unpin,
impl<T> UnwindSafe for WorkerLayer<T>where
T: UnwindSafe,
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