pub struct RouteGroup<S = ()>{ /* private fields */ }
Expand description
Route group for organizing related routes with shared configuration
Implementations§
Source§impl<S> RouteGroup<S>
impl<S> RouteGroup<S>
Sourcepub fn new(
name: &str,
prefix: &str,
registry: Arc<Mutex<RouteRegistry>>,
) -> Self
pub fn new( name: &str, prefix: &str, registry: Arc<Mutex<RouteRegistry>>, ) -> Self
Create a new route group
Sourcepub fn get<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn get<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a GET route to the group
Sourcepub fn post<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn post<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a POST route to the group
Sourcepub fn put<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn put<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a PUT route to the group
Sourcepub fn delete<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn delete<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a DELETE route to the group
Sourcepub fn patch<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn patch<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a PATCH route to the group
Sourcepub fn route<H, T>(
self,
method: HttpMethod,
path: &str,
name: &str,
handler: H,
) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn route<H, T>(
self,
method: HttpMethod,
path: &str,
name: &str,
handler: H,
) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a named route
Sourcepub fn into_router(self) -> AxumRouter<S>
pub fn into_router(self) -> AxumRouter<S>
Convert to Axum router for mounting
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for RouteGroup<S>
impl<S = ()> !RefUnwindSafe for RouteGroup<S>
impl<S> Send for RouteGroup<S>
impl<S> Sync for RouteGroup<S>
impl<S> Unpin for RouteGroup<S>
impl<S = ()> !UnwindSafe for RouteGroup<S>
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