[][src]Struct webworker::router::Router

pub struct Router {
    pub tree: PathTree<Box<dyn Fn(Request, Params) -> Response>>,
}

Fields

tree: PathTree<Box<dyn Fn(Request, Params) -> Response>>

Implementations

impl Router[src]

pub fn new() -> Router[src]

pub fn add(
    &mut self,
    method: &str,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with method, path and the handler.

pub fn get(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with GET method.

pub fn post(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with POST method.

pub fn put(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with PUT method.

pub fn patch(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with PATCH method.

pub fn delete(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with DELETE method.

pub fn connect(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with CONNECT method.

pub fn head(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with HEAD method.

pub fn options(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with OPTIONS method.

pub fn trace(
    &mut self,
    path: &str,
    data: Box<dyn Fn(Request, Params) -> Response>
)
[src]

Add a new route with TRACE method.

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.