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

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

There is a newer version: 3.0.0-rc1
Show newest version
//! Main library entry point for {{externCrateName}} implementation.

mod server;

mod errors {
    error_chain!{}
}

pub use self::errors::*;
use std::io;
use std::clone::Clone;
use std::marker::PhantomData;
use hyper;
use {{externCrateName}};
use swagger::{Has, XSpanIdString};
use swagger::auth::Authorization;

pub struct NewService{
    marker: PhantomData
}

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

impl hyper::server::NewService for NewService where C: Has {{#hasAuthMethods}}+ Has>{{/hasAuthMethods}} + Clone + 'static {
    type Request = (hyper::Request, C);
    type Response = hyper::Response;
    type Error = hyper::Error;
    type Instance = {{externCrateName}}::server::Service, C>;

    /// Instantiate a new server.
    fn new_service(&self) -> io::Result {
        Ok({{externCrateName}}::server::Service::new(server::Server::new()))
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy