pub struct LayerStack<S> { /* private fields */ }Expand description
A stack for managing and applying middleware layers to a router.
LayerStack provides a way to accumulate layers and apply them to a router in the
order they were added. Layers are applied via the push() method during configuration,
and then applied to the router via apply() during the build phase.
Implementations§
Source§impl<S> LayerStack<S>
impl<S> LayerStack<S>
pub fn new() -> LayerStack<S>
Sourcepub fn push<L>(&mut self, layer: L)where
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + Sync + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<Infallible> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
pub fn push<L>(&mut self, layer: L)where
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + Sync + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<Infallible> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
Add a layer to the stack.
Layers are applied in FIFO order when apply() is called. Each layer will
wrap the router after all controllers have been registered.
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for LayerStack<S>
impl<S> !UnwindSafe for LayerStack<S>
impl<S> Freeze for LayerStack<S>
impl<S> Send for LayerStack<S>
impl<S> Sync for LayerStack<S>
impl<S> Unpin for LayerStack<S>
impl<S> UnsafeUnpin for LayerStack<S>
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