pub struct Router { /* private fields */ }
Expand description
A routes collection.
Implementations§
source§impl Router
impl Router
sourcepub fn route<S>(self, path: S, route: Route) -> Self
pub fn route<S>(self, path: S, route: Route) -> Self
Inserts a path-route pair into the router.
sourcepub fn get<S, H, O>(self, path: S, handler: H) -> Self
pub fn get<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP GET
verb pair.
sourcepub fn post<S, H, O>(self, path: S, handler: H) -> Self
pub fn post<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP POST
verb pair.
sourcepub fn put<S, H, O>(self, path: S, handler: H) -> Self
pub fn put<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP PUT
verb pair.
sourcepub fn delete<S, H, O>(self, path: S, handler: H) -> Self
pub fn delete<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP DELETE
verb pair.
sourcepub fn head<S, H, O>(self, path: S, handler: H) -> Self
pub fn head<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP HEAD
verb pair.
sourcepub fn options<S, H, O>(self, path: S, handler: H) -> Self
pub fn options<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP OPTIONS
verb pair.
sourcepub fn connect<S, H, O>(self, path: S, handler: H) -> Self
pub fn connect<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP CONNECT
verb pair.
sourcepub fn patch<S, H, O>(self, path: S, handler: H) -> Self
pub fn patch<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP PATCH
verb pair.
sourcepub fn trace<S, H, O>(self, path: S, handler: H) -> Self
pub fn trace<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and HTTP TRACE
verb pair.
sourcepub fn any<S, H, O>(self, path: S, handler: H) -> Self
pub fn any<S, H, O>(self, path: S, handler: H) -> Self
Adds a handler with a path and any HTTP verbs.“
sourcepub fn map_handler<F>(self, f: F) -> Self
pub fn map_handler<F>(self, f: F) -> Self
Takes a closure and creates an iterator which calls that closure on each handler.
sourcepub fn with_handler<H>(self, f: H) -> Self
pub fn with_handler<H>(self, f: H) -> Self
Adds a middleware for the routes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)