pub struct RouterBuilder<T: Clone> { /* private fields */ }Expand description
Router builder
Implementations§
Source§impl<T: Clone> RouterBuilder<T>
impl<T: Clone> RouterBuilder<T>
Sourcepub fn post_layer(
self,
layer: fn(&Request, &mut T, Response) -> Response,
) -> Self
pub fn post_layer( self, layer: fn(&Request, &mut T, Response) -> Response, ) -> Self
Add post layer
Sourcepub fn route(
self,
methods: &[Method],
route: String,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn route( self, methods: &[Method], route: String, handler: fn(&Request, &T) -> Response, ) -> Self
Add route
Sourcepub fn any(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn any( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for any method
Sourcepub fn get(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn get( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for GET method
Sourcepub fn head(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn head( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for HEAD method
Sourcepub fn post(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn post( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for POST method
Sourcepub fn put(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn put( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for PUT method
Sourcepub fn delete(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn delete( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for DELETE method
Sourcepub fn connect(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn connect( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for CONNECT method
Sourcepub fn options(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn options( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for OPTIONS method
Sourcepub fn trace(
self,
route: impl Into<String>,
handler: fn(&Request, &T) -> Response,
) -> Self
pub fn trace( self, route: impl Into<String>, handler: fn(&Request, &T) -> Response, ) -> Self
Add route for TRACE method
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RouterBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for RouterBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for RouterBuilder<T>where
T: Send,
impl<T> Sync for RouterBuilder<T>where
T: Sync,
impl<T> Unpin for RouterBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for RouterBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more