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

rust-server.example-server_server.mustache Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
//! Server implementation of {{{externCrateName}}}.

#![allow(unused_imports)]

use futures::{self, Future};
use chrono;
use std::collections::HashMap;
use std::marker::PhantomData;
{{#apiUsesUuid}}use uuid;{{/apiUsesUuid}}
use swagger;
use swagger::{Has, XSpanIdString};

use {{{externCrateName}}}::{Api, ApiError{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}},
                      {{{operationId}}}Response{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
};
use {{{externCrateName}}}::models;

#[derive(Copy, Clone)]
pub struct Server {
    marker: PhantomData,
}

impl Server {
    pub fn new() -> Self {
        Server{marker: PhantomData}
    }
}

impl Api for Server where C: Has{
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
{{#summary}}    /// {{{summary}}}{{/summary}}
    fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box> {
        let context = context.clone();
        println!("{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}{{#vendorExtensions}}{{{formatString}}}{{/vendorExtensions}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) - X-Span-ID: {:?}"{{#allParams}}, {{{paramName}}}{{/allParams}}, context.get().0.clone());{{#allParams}}{{/allParams}}
        Box::new(futures::failed("Generic failure".into()))
    }
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy