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> Group<S>
impl<S> Group<S>
Sourcepub fn guard<G>(self, guard: G) -> Group<S>
pub fn guard<G>(self, guard: G) -> Group<S>
Run guard before every route of this group (and its nested groups).
Sourcepub fn wrap<M>(self, layer: M) -> Group<S>where
M: Middleware + 'static,
pub fn wrap<M>(self, layer: M) -> Group<S>where
M: Middleware + 'static,
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) -> Group<S>
pub fn get<F>(self, pattern: &str, handler: F) -> Group<S>
Register a GET handler at prefix + pattern.
Sourcepub fn post<F>(self, pattern: &str, handler: F) -> Group<S>
pub fn post<F>(self, pattern: &str, handler: F) -> Group<S>
Register a POST handler at prefix + pattern.
Sourcepub fn put<F>(self, pattern: &str, handler: F) -> Group<S>
pub fn put<F>(self, pattern: &str, handler: F) -> Group<S>
Register a PUT handler at prefix + pattern.
Sourcepub fn patch<F>(self, pattern: &str, handler: F) -> Group<S>
pub fn patch<F>(self, pattern: &str, handler: F) -> Group<S>
Register a PATCH handler at prefix + pattern.
Sourcepub fn delete<F>(self, pattern: &str, handler: F) -> Group<S>
pub fn delete<F>(self, pattern: &str, handler: F) -> Group<S>
Register a DELETE handler at prefix + pattern.
Sourcepub fn route<H>(self, handler: H) -> Group<S>where
H: Handler<S>,
pub fn route<H>(self, handler: H) -> Group<S>where
H: Handler<S>,
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> Move 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> + Send + Sync>>: UnsafeUnpin,
Vec<GroupRoute<Arc<dyn Fn(&Request, &PathParams, &ConnectionInfo, &Arc<S>) -> Response + Send + Sync>>>: 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more