pub struct AsyncGroup<S> { /* private fields */ }Available on crate feature
http2 only.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: Send + Sync + 'static> AsyncGroup<S>
impl<S: Send + Sync + 'static> AsyncGroup<S>
Sourcepub fn get<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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) -> Selfwhere
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: AsyncHandler<S>>(self, handler: H) -> Self
pub fn route<H: AsyncHandler<S>>(self, handler: H) -> Self
Register a typed handler (#[get("/path")] & co.) at
prefix + its pattern.
Sourcepub fn group(
self,
pattern: &str,
build: impl FnOnce(AsyncGroup<S>) -> AsyncGroup<S>,
) -> Self
pub fn group( self, pattern: &str, build: impl FnOnce(AsyncGroup<S>) -> AsyncGroup<S>, ) -> Self
A nested group at prefix + pattern.
Sourcepub fn resource(
self,
path: &str,
build: impl FnOnce(AsyncResource<S>) -> AsyncResource<S>,
) -> Self
pub fn resource( self, path: &str, build: impl FnOnce(AsyncResource<S>) -> AsyncResource<S>, ) -> Self
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 more