Struct iron_mountrouter::MethodPicker [] [src]

pub struct MethodPicker {
    // some fields omitted
}

MethodPicker provides an interface to apply different handlers for different http methods as middleware for the Iron framework.

Methods

impl MethodPicker

fn new() -> MethodPicker

Construct new MethodPicker.

let picker = MethodPicker::new();

fn add<H: Handler>(&mut self, method: Method, handler: H) -> &mut MethodPicker

Adds new handler to picker

method is any Iron's http method.

handler will be used for specified method

fn get<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for GET http method to picker

fn post<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for POST http method to picker

fn put<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for PUT http method to picker

fn delete<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for DELETE http method to picker

fn head<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for HEAD http method to picker

fn patch<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for PATCH http method to picker

fn options<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds new handler for OPTIONS http method to picker

fn default<H: Handler>(&mut self, handler: H) -> &mut MethodPicker

Adds default handler to picker which will be used if no method matched

Trait Implementations

impl Handler for MethodPicker

fn handle(&self, req: &mut Request) -> IronResult<Response>