LayerConfigurator

Trait LayerConfigurator 

Source
pub trait LayerConfigurator {
    // Required method
    fn add_router_layer<F>(&mut self, layer: F) -> &mut Self
       where F: Fn(Router) -> Router + Send + Sync + 'static;
}
Expand description

Trait for adding layers to the web router

Required Methods§

Source

fn add_router_layer<F>(&mut self, layer: F) -> &mut Self
where F: Fn(Router) -> Router + Send + Sync + 'static,

Add a layer function that will be applied to the router before the server starts.

Layers are applied in the order they are added.

§Example
use spring_web::LayerConfigurator;

app.add_router_layer(|router| {
    router.layer(MyAuthLayer::new(state))
});

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl LayerConfigurator for AppBuilder

Source§

fn add_router_layer<F>(&mut self, layer: F) -> &mut Self
where F: Fn(Router) -> Router + Send + Sync + 'static,

Implementors§