Struct hyper_router::Route [] [src]

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

Holds route information

Fields

HTTP method to match

Path to match

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]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

impl Default for Route
[src]

[src]

Returns the "default value" for a type. Read more

impl Debug for Route
[src]

[src]

Formats the value using the given formatter. Read more