pub struct RouteGroup { /* private fields */ }Expand description
Route group builder
Implementations§
Source§impl RouteGroup
impl RouteGroup
Sourcepub fn ws_with<F, Fut>(self, path: &str, options: WsOptions, handler: F) -> Self
pub fn ws_with<F, Fut>(self, path: &str, options: WsOptions, handler: F) -> Self
Accept WebSocket connections on path below the group prefix; the
group’s middleware (authentication, ticket checks, …) runs before the
upgrade (feature websocket)
Sourcepub fn max_body_size(self, limit: Option<usize>) -> Self
pub fn max_body_size(self, limit: Option<usize>) -> Self
Request body limit for this group’s routes (None = unlimited),
overriding the application default
Sourcepub fn doc(self, method: &str, path: &str, operation: Operation) -> Self
pub fn doc(self, method: &str, path: &str, operation: Operation) -> Self
Describe a route of this group for the OpenAPI document; path is
relative to the group prefix, as given to get/post/…
pub fn get<H>(self, path: &str, handler: H) -> Selfwhere
H: Handler,
pub fn post<H>(self, path: &str, handler: H) -> Selfwhere
H: Handler,
pub fn put<H>(self, path: &str, handler: H) -> Selfwhere
H: Handler,
pub fn delete<H>(self, path: &str, handler: H) -> Selfwhere
H: Handler,
pub fn patch<H>(self, path: &str, handler: H) -> Selfwhere
H: Handler,
Sourcepub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
Add middleware that runs only for the routes of this group
It runs after the application-wide middleware, in registration order, regardless of whether it is added before or after the routes.
Auto Trait Implementations§
impl !RefUnwindSafe for RouteGroup
impl !UnwindSafe for RouteGroup
impl Freeze for RouteGroup
impl Send for RouteGroup
impl Sync for RouteGroup
impl Unpin for RouteGroup
impl UnsafeUnpin for RouteGroup
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