Struct hyper_router::route::Route [] [src]

pub struct Route {
    pub method: Method,
    pub path: Path,
    pub handler: Handler,
}

Holds route information

Fields

method

HTTP method to match

path

Path to match

handler

Request handler

This should be method that accepts Hyper's Request and Response:

use hyper::server::{Request, Response};

fn hello_handler(_: Request, res: Response) {
  res.send(b"Hello World").unwrap();
}

Methods

impl Route

fn options(path: &str) -> RouteBuilder

fn get(path: &str) -> RouteBuilder

fn post(path: &str) -> RouteBuilder

fn put(path: &str) -> RouteBuilder

fn delete(path: &str) -> RouteBuilder

fn head(path: &str) -> RouteBuilder

fn trace(path: &str) -> RouteBuilder

fn connect(path: &str) -> RouteBuilder

fn patch(path: &str) -> RouteBuilder

fn from(method: Method, path: &str) -> RouteBuilder

Trait Implementations

impl Default for Route

fn default() -> Route

impl Debug for Route

fn fmt(&self, f: &mut Formatter) -> Result