pub struct AsyncGroup<S> { /* private fields */ }Expand description
Group for AsyncAppWithState: async handlers,
guards (sync checks before the handler runs). Middleware wraps the
whole app there (app.wrap(layer)), not a group.
Implementations§
Source§impl<S> AsyncGroup<S>
impl<S> AsyncGroup<S>
Sourcepub fn guard<G>(self, guard: G) -> AsyncGroup<S>
pub fn guard<G>(self, guard: G) -> AsyncGroup<S>
Run guard before every route of this group.
Sourcepub fn name(self, name: &str) -> AsyncGroup<S>
pub fn name(self, name: &str) -> AsyncGroup<S>
Name the route registered last, for url_for.
Sourcepub fn get<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn get<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async GET handler at prefix + pattern.
Sourcepub fn post<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn post<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async POST handler at prefix + pattern.
Sourcepub fn put<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn put<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async PUT handler at prefix + pattern.
Sourcepub fn patch<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn patch<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async PATCH handler at prefix + pattern.
Sourcepub fn delete<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn delete<F, Fut>(self, pattern: &str, handler: F) -> AsyncGroup<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async DELETE handler at prefix + pattern.
Sourcepub fn route<H>(self, handler: H) -> AsyncGroup<S>where
H: AsyncHandler<S>,
pub fn route<H>(self, handler: H) -> AsyncGroup<S>where
H: AsyncHandler<S>,
Register a typed handler (#[get("/path")] & co.) at
prefix + its pattern.
Sourcepub fn group(
self,
pattern: &str,
build: impl FnOnce(AsyncGroup<S>) -> AsyncGroup<S>,
) -> AsyncGroup<S>
pub fn group( self, pattern: &str, build: impl FnOnce(AsyncGroup<S>) -> AsyncGroup<S>, ) -> AsyncGroup<S>
A nested group at prefix + pattern.
Sourcepub fn resource(
self,
path: &str,
build: impl FnOnce(AsyncResource<S>) -> AsyncResource<S>,
) -> AsyncGroup<S>
pub fn resource( self, path: &str, build: impl FnOnce(AsyncResource<S>) -> AsyncResource<S>, ) -> AsyncGroup<S>
The conventional routes of a resource at prefix + path.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for AsyncGroup<S>
impl<S> !UnwindSafe for AsyncGroup<S>
impl<S> Forget for AsyncGroup<S>
impl<S> Freeze for AsyncGroup<S>
impl<S> Send for AsyncGroup<S>
impl<S> Sync for AsyncGroup<S>
impl<S> Unpin for AsyncGroup<S>
impl<S> UnsafeUnpin for AsyncGroup<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
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