pub struct RouteGroup<R = ()> { /* private fields */ }Expand description
A group of HTTP routes that share a common path prefix (and optionally shared per-route Tower layers).
See HttpIngress::route_group for usage examples.
Implementations§
Source§impl<R> RouteGroup<R>
impl<R> RouteGroup<R>
Sourcepub fn new(prefix: impl Into<String>) -> Self
pub fn new(prefix: impl Into<String>) -> Self
Create a new RouteGroup with the given path prefix.
The prefix is automatically normalised: a leading / is added if
absent, and a trailing / is removed.
Sourcepub fn get<Out, E>(
self,
sub_path: impl Into<String>,
circuit: Axon<(), Out, E, R>,
) -> Self
pub fn get<Out, E>( self, sub_path: impl Into<String>, circuit: Axon<(), Out, E, R>, ) -> Self
Register a GET route relative to this group’s prefix.
Sourcepub fn post<Out, E>(
self,
sub_path: impl Into<String>,
circuit: Axon<(), Out, E, R>,
) -> Self
pub fn post<Out, E>( self, sub_path: impl Into<String>, circuit: Axon<(), Out, E, R>, ) -> Self
Register a POST route relative to this group’s prefix.
Sourcepub fn put<Out, E>(
self,
sub_path: impl Into<String>,
circuit: Axon<(), Out, E, R>,
) -> Self
pub fn put<Out, E>( self, sub_path: impl Into<String>, circuit: Axon<(), Out, E, R>, ) -> Self
Register a PUT route relative to this group’s prefix.
Sourcepub fn patch<Out, E>(
self,
sub_path: impl Into<String>,
circuit: Axon<(), Out, E, R>,
) -> Self
pub fn patch<Out, E>( self, sub_path: impl Into<String>, circuit: Axon<(), Out, E, R>, ) -> Self
Register a PATCH route relative to this group’s prefix.
Sourcepub fn delete<Out, E>(
self,
sub_path: impl Into<String>,
circuit: Axon<(), Out, E, R>,
) -> Self
pub fn delete<Out, E>( self, sub_path: impl Into<String>, circuit: Axon<(), Out, E, R>, ) -> Self
Register a DELETE route relative to this group’s prefix.
Sourcepub fn method<Out, E>(
self,
method: Method,
sub_path: impl Into<String>,
circuit: Axon<(), Out, E, R>,
) -> Self
pub fn method<Out, E>( self, method: Method, sub_path: impl Into<String>, circuit: Axon<(), Out, E, R>, ) -> Self
Register a route with an arbitrary HTTP method relative to this group’s prefix.
Sourcepub fn group(self, child: RouteGroup<R>) -> Self
pub fn group(self, child: RouteGroup<R>) -> Self
Nest a child RouteGroup inside this group.
The child’s prefix is appended to the parent’s prefix.
Auto Trait Implementations§
impl<R> Freeze for RouteGroup<R>
impl<R = ()> !RefUnwindSafe for RouteGroup<R>
impl<R> Send for RouteGroup<R>
impl<R> Sync for RouteGroup<R>
impl<R> Unpin for RouteGroup<R>
impl<R> UnsafeUnpin for RouteGroup<R>
impl<R = ()> !UnwindSafe for RouteGroup<R>
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