Struct saphir::Router[][src]

pub struct Router { /* fields omitted */ }

A Struct responsible of dispatching request towards controllers

Methods

impl Router
[src]

Add a new controller with its route to the router

Example

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

let mut router = Router::new();
router.add("/test", u8_controller);

Add a new controller with its route to the router

Example

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

let mut router = Router::new();
router.add("/test", u8_controller);

Trait Implementations

impl Clone for Router
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Router

impl Sync for Router