All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rust-server.server-mod.mustache Maven / Gradle / Ivy

There is a newer version: 6.2.1.2
Show newest version
{{>server-imports}}
use crate::{Api{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}},
     {{{operationId}}}Response{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
};

{{#hasCallbacks}}
pub mod callbacks;

{{/hasCallbacks}}
{{>server-paths}}
{{>server-make-service}}
{{>server-service-header}}
{{#apiInfo}}
  {{#apis}}
    {{#operations}}
      {{#operation}}
{{>server-operation}}
      {{/operation}}
    {{/operations}}
  {{/apis}}
{{/apiInfo}}
{{#pathSet}}
            _ if path.matched(paths::ID_{{PATH_ID}}) => method_not_allowed(),
{{/pathSet}}
{{>server-service-footer}}
/// Request parser for `Api`.
pub struct ApiRequestParser;
impl RequestParser for ApiRequestParser {
    fn parse_operation_id(request: &Request) -> Result<&'static str, ()> {
        let path = paths::GLOBAL_REGEX_SET.matches(request.uri().path());
        match request.method() {
{{#apiInfo}}
  {{#apis}}
    {{#operations}}
      {{#operation}}
            // {{{operationId}}} - {{{httpMethod}}} {{{path}}}
            &hyper::Method::{{{vendorExtensions.x-http-method}}} if path.matched(paths::ID_{{{vendorExtensions.x-path-id}}}) => Ok("{{{operationId}}}"),
      {{/operation}}
    {{/operations}}
  {{/apis}}
{{/apiInfo}}
            _ => Err(()),
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy