pub fn on<T>(self, method: MethodFilter, svc: T) -> OnMethod<T, Self, B>
    where
        T: Service<Request<B>> + Clone,
    {
        OnMethod {
            method,
            svc,
            fallback: self,
            _request_body: PhantomData,
        }
    }
/// Chain an additional service that will accept requests matching the given
/// `MethodFilter`.
///
/// # Example
///
/// ```rust
/// use axum::{
///     http::Request,
///     handler::on,
///     service,
///     Router,
///     routing::MethodFilter,
/// };
/// use http::Response;
/// use std::convert::Infallible;
/// use hyper::Body;
///
/// let service = tower::service_fn(|request: Request<Body>| async {
///     Ok::<_, Infallible>(Response::new(Body::empty()))
/// });
///
/// let other_service = tower::service_fn(|request: Request<Body>| async {
///     Ok::<_, Infallible>(Response::new(Body::empty()))
/// });
///
/// // Requests to `DELETE /` will go to `service`
/// let app = Router::new().route("/", service::on(MethodFilter::DELETE, service));
/// # async {
/// # axum::Server::bind(&"".parse().unwrap()).serve(app.into_make_service()).await.unwrap();
/// # };
/// ```
Chain an additional service that will accept requests matching the given
`MethodFilter`.
Chain an additional service that will accept requests matching the given ` MethodFilter ` .
pub fn on<T>(self, method: MethodFilter, svc: T) -> OnMethod<T, Self, B>
    where
        T: Service<Request<B>> + Clone,
    {
        OnMethod {
            method,
            svc,
            fallback: self,
            _request_body: PhantomData,
        }
    }
pub fn on < T > ( self , method : MethodFilter , svc : T ) -> OnMethod < T , Self , B > where T : Service < Request < B > > + Clone , { OnMethod { method , svc , fallback : self , _request_body : PhantomData , } }
Chain an additional service that will accept requests matching the given
`MethodFilter`.
Chain an additional service that will accept requests matching the given ` MethodFilter ` .
self
method
MethodFilter
svc
T
self
method
MethodFilter
svc
T
example
```rust
use axum::{
http::Request,
handler::on,
service,
Router,
routing::MethodFilter,
};
use http::Response;
use std::convert::Infallible;
use hyper::Body.

let service = tower::service_fn(|request: Request| async {
Ok::<_, Infallible>(Response::new(Body::empty()))
}).

let other_service = tower::service_fn(|request: Request| async {
Ok::<_, Infallible>(Response::new(Body::empty()))
}).

Requests to `DELETE /` will go to `service`
let app = Router::new().route("/", service::on(MethodFilter::DELETE, service)).
` ` ` rust use axum :: { http :: Request handler :: on service Router routing :: MethodFilter } ; use http :: Response ; use std :: convert :: Infallible ; use hyper :: Body . let service = tower :: service_fn ( |request : Request| async { Ok :: <_ Infallible > ( Response :: new ( Body :: empty () )) } ) . let other_service = tower :: service_fn ( |request : Request| async { Ok :: <_ Infallible > ( Response :: new ( Body :: empty () )) } ) . Requests to ` DELETE / ` will go to ` service ` let app = Router :: new () . route ( " / " service :: on ( MethodFilter :: DELETE service )) .
async {
None
axum::server::bind(&"".parse().unwrap()).serve(app.into_make_service()).await.unwrap();
None
};
None