1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
//! Methods for retrieving swagger-related information from an HTTP request. use hyper::Request; /// A trait for retrieving swagger-related information from a request. /// /// This allows other middlewares to retrieve API-related information from a request that /// may not have been handled by the autogenerated API code yet. For example, a statistics /// tracking service may wish to use this to count requests per-operation. /// /// The trait is automatically implemented by swagger-codegen. pub trait RequestParser { /// Retrieve the Swagger operation identifier that matches this request. /// /// Returns `Err(())` if this request does not match any known operation on this API. fn parse_operation_id(req: &Request) -> Result<&'static str, ()>; }