fn layer<L>(self, layer: L) -> Layered<L::Service, T>
    where
        L: Layer<IntoService<Self, B, T>>,
    {
        Layered::new(layer.layer(self.into_service()))
    }
/// Apply a [`tower::Layer`] to the handler.
///
/// All requests to the handler will be processed by the layer's
/// corresponding middleware.
///
/// This can be used to add additional processing to a request for a single
/// handler.
///
/// Note this differs from [`routing::Router::layer`](crate::routing::Router::layer)
/// which adds a middleware to a group of routes.
///
/// If you're applying middleware that produces errors you have to handle the errors
/// so they're converted into responses. You can learn more about doing that
/// [here](crate::error_handling).
///
/// # Example
///
/// Adding the [`tower::limit::ConcurrencyLimit`] middleware to a handler
/// can be done like so:
///
/// ```rust
/// use axum::{
///     routing::get,
///     handler::Handler,
///     Router,
/// };
/// use tower::limit::{ConcurrencyLimitLayer, ConcurrencyLimit};
///
/// async fn handler() { /* ... */ }
///
/// let layered_handler = handler.layer(ConcurrencyLimitLayer::new(64));
/// let app = Router::new().route("/", get(layered_handler));
/// # async {
/// # axum::Server::bind(&"".parse().unwrap()).serve(app.into_make_service()).await.unwrap();
/// # };
/// ```
Apply a [`tower::Layer`] to the handler.
All requests to the handler will be processed by the layer's
corresponding middleware.

This can be used to add additional processing to a request for a single
handler.



If you're applying middleware that produces errors you have to handle the errors
so they're converted into responses. You can learn more about doing that
[here](crate::error_handling).
Apply a [ ` tower :: Layer ` ] to the handler . All requests to the handler will be processed by the layer ' s corresponding middleware . This can be used to add additional processing to a request for a single handler . If you ' re applying middleware that produces errors you have to handle the errors so they ' re converted into responses . You can learn more about doing that [ here ] ( crate :: error_handling ) .
fn layer<L>(self, layer: L) -> Layered<L::Service, T>
    where
        L: Layer<IntoService<Self, B, T>>,
    {
        Layered::new(layer.layer(self.into_service()))
    }
fn layer < L > ( self , layer : L ) -> Layered < L :: Service , T > where L : Layer < IntoService < Self , B , T > > , { Layered :: new ( layer . layer ( self . into_service ( ) ) ) }
Apply a [`tower::Layer`] to the handler.
Apply a [ ` tower :: Layer ` ] to the handler .
self
layer
L
example
Adding the [`tower::limit::ConcurrencyLimit`] middleware to a handler
can be done like so.

```rust
use axum::{
routing::get,
handler::Handler,
Router,
};
use tower::limit::{ConcurrencyLimitLayer, ConcurrencyLimit}.

async fn handler() {  ...

let layered_handler = handler.layer(ConcurrencyLimitLayer::new(64));
let app = Router::new().route("/", get(layered_handler)).
Adding the [ ` tower :: limit :: ConcurrencyLimit ` ] middleware to a handler can be done like so . ` ` ` rust use axum :: { routing :: get handler :: Handler Router } ; use tower :: limit :: { ConcurrencyLimitLayer ConcurrencyLimit } . async fn handler () { ... let layered_handler = handler . layer ( ConcurrencyLimitLayer :: new ( 64 )) ; let app = Router :: new () . route ( " / " get ( layered_handler )) .
async {
None
axum::server::bind(&"".parse().unwrap()).serve(app.into_make_service()).await.unwrap();
None
};
None