async_http_router 0.0.4

a simple http_router for web server
Documentation
use crate::constraint::{INDEX, NOTFOUND};
use async_trait::async_trait;
use futures;
use futures::{future, Future};
use hyper;
use hyper::http::Result;
use hyper::{Body, Method, Request, Response, StatusCode};
use hyper_tls;
use std::str;

#[async_trait]
pub trait HttpWays {
    async fn post(&self, req: Request<Body>, re_url_matched: &str) -> Result<Response<Body>> {
        let body = Body::from(NOTFOUND);
        Response::builder().status(StatusCode::NOT_FOUND).body(body)
    }
    async fn get(&self, req: Request<Body>, re_url_matched: &str) -> Result<Response<Body>> {
        let body = Body::from(NOTFOUND);
        Response::builder().status(StatusCode::NOT_FOUND).body(body)
    }
    async fn default(&self) -> Result<Response<Body>> {
        let body = Body::from(NOTFOUND);
        Response::builder().status(StatusCode::NOT_FOUND).body(body)
    }
    async fn dispatch(&self, req: Request<Body>, re_url_matched: &str) -> Result<Response<Body>> {
        let method = &req.method();
        match method {
            &&Method::GET => self.get(req, re_url_matched).await,
            &&Method::POST => self.post(req, re_url_matched).await,
            _ => self.default().await,
        }
    }
}