[][src]Struct saphir::controller::ControllerDispatch

pub struct ControllerDispatch<T> { /* fields omitted */ }

Struct to delegate a request to a registered function matching booth a method and a path

Methods

impl<T: Send + Sync> ControllerDispatch<T>
[src]

Add a delegate function to handle a particular request

Example

let u8_context = 1;
let dispatch = ControllerDispatch::new(u8_context);
dispatch.add(Method::Get, "^/test$", |ctx, req, res| { println!("this will handle Get request done on <your_host>/test")});

Add a delegate function to handle a particular request

Example

let u8_context = 1;
let guard = BodyGuard;
let dispatch = ControllerDispatch::new(u8_context);
dispatch.add_with_guards(Method::Get, "^/test$", guard.into(), |ctx, req, res| { println!("this will handle Get request done on <your_host>/test")});

Trait Implementations

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
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

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]

🔬 This is a nightly-only experimental API. (try_from)

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