pub struct Route {
pub path: String,
pub handlers: HashMap<Method, fn(UrlParams, Request<Body>) -> Response<Body>>,
}
Fields§
§path: String
Path to match
handlers: HashMap<Method, fn(UrlParams, Request<Body>) -> Response<Body>>
Request handlers
Implementations§
Source§impl Route
impl Route
Sourcepub fn options(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn options( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for OPTIONS type requests
Sourcepub fn get(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn get( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for GET type requests
Sourcepub fn post(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn post( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for POST type requests
Sourcepub fn put(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn put( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for PUT type requests
Sourcepub fn delete(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn delete( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for DELETE type requests
Sourcepub fn head(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn head( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for HEAD type requests
Sourcepub fn trace(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn trace( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for TRACE type requests
Sourcepub fn connect(
self,
handler: fn(UrlParams, Request<Body>) -> Response<Body>,
) -> Self
pub fn connect( self, handler: fn(UrlParams, Request<Body>) -> Response<Body>, ) -> Self
Add handler for CONNECT type requests
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnwindSafe for Route
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