pub struct Builder { /* private fields */ }
Expand description
Implementations
sourceimpl Builder
impl Builder
sourcepub fn add<C: 'static + Controller>(self, controller: C) -> Self
pub fn add<C: 'static + Controller>(self, controller: C) -> Self
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);
sourcepub fn route<C: 'static + Controller, R: ToRegex>(
self,
route: R,
controller: C
) -> Self
pub fn route<C: 'static + Controller, R: ToRegex>(
self,
route: R,
controller: C
) -> Self
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);
Auto Trait Implementations
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more