[][src]Struct hyper_router::Route

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

Holds route information

Fields

method: Method

HTTP method to match

path: Path

Path to match

handler: Handler

Request handler

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

This example is not tested
use hyper::server::{Request, Response};
use hyper::header::{ContentLength, ContentType};

fn hello_handler(_: Request) -> Response {
    let body = "Hello World";
    Response::new()
        .with_header(ContentLength(body.len() as u64))
        .with_header(ContentType::plaintext())
        .with_body(body)
}

Methods

impl Route[src]

pub fn options(path: &str) -> RouteBuilder[src]

pub fn get(path: &str) -> RouteBuilder[src]

pub fn post(path: &str) -> RouteBuilder[src]

pub fn put(path: &str) -> RouteBuilder[src]

pub fn delete(path: &str) -> RouteBuilder[src]

pub fn head(path: &str) -> RouteBuilder[src]

pub fn trace(path: &str) -> RouteBuilder[src]

pub fn connect(path: &str) -> RouteBuilder[src]

pub fn patch(path: &str) -> RouteBuilder[src]

pub fn from(method: Method, path: &str) -> RouteBuilder[src]

Trait Implementations

impl Default for Route[src]

impl Debug for Route[src]

Auto Trait Implementations

impl Send for Route

impl Sync for Route

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T