pub struct Group<S> { /* private fields */ }Expand description
Routes under one path prefix for AppWithState,
sharing guards and middleware. Made by app.group(prefix, |g| …).
Implementations§
Source§impl<S: Send + Sync + 'static> Group<S>
impl<S: Send + Sync + 'static> Group<S>
Sourcepub fn guard<G>(self, guard: G) -> Self
pub fn guard<G>(self, guard: G) -> Self
Run guard before every route of this group (and its nested groups).
Sourcepub fn wrap<M: Middleware + 'static>(self, layer: M) -> Self
pub fn wrap<M: Middleware + 'static>(self, layer: M) -> Self
Run layer around every route of this group, inside its guards;
the first layer added is the outermost.
Sourcepub fn get<F>(self, pattern: &str, handler: F) -> Self
pub fn get<F>(self, pattern: &str, handler: F) -> Self
Register a GET handler at prefix + pattern.
Sourcepub fn post<F>(self, pattern: &str, handler: F) -> Self
pub fn post<F>(self, pattern: &str, handler: F) -> Self
Register a POST handler at prefix + pattern.
Sourcepub fn put<F>(self, pattern: &str, handler: F) -> Self
pub fn put<F>(self, pattern: &str, handler: F) -> Self
Register a PUT handler at prefix + pattern.
Sourcepub fn patch<F>(self, pattern: &str, handler: F) -> Self
pub fn patch<F>(self, pattern: &str, handler: F) -> Self
Register a PATCH handler at prefix + pattern.
Sourcepub fn delete<F>(self, pattern: &str, handler: F) -> Self
pub fn delete<F>(self, pattern: &str, handler: F) -> Self
Register a DELETE handler at prefix + pattern.
Sourcepub fn route<H: Handler<S>>(self, handler: H) -> Self
pub fn route<H: Handler<S>>(self, handler: H) -> Self
Register a typed handler (#[get("/path")] & co.) at
prefix + its pattern.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for Group<S>
impl<S> !UnwindSafe for Group<S>
impl<S> Forget for Group<S>
impl<S> Freeze for Group<S>
impl<S> Send for Group<S>
impl<S> Sync for Group<S>
impl<S> Unpin for Group<S>
impl<S> UnsafeUnpin for Group<S>where
Vec<Arc<dyn Fn(&Request, &ConnectionInfo, &S) -> Result<(), Response> + Sync + Send>>: UnsafeUnpin,
Vec<GroupRoute<Arc<dyn Fn(&Request, &PathParams, &ConnectionInfo, &Arc<S>) -> Response + Sync + Send>>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more