Function on_service
pub fn on_service<T, S>(filter: MethodFilter, svc: T) -> MethodRouter<S, T::Error>
where
T: Service<Request> + Clone + Send + Sync + 'static,
T::Response: IntoResponse + 'static,
T::Future: Send + 'static,
S: Clone,
Route requests with the given method to the service.
Example
use ;
use Response;
use Infallible;
let service = service_fn;
// Requests to `POST /` will go to `service`.
let app = new.route;
# let _: Router = app;