pub struct AsyncResource<S> { /* private fields */ }Expand description
Resource for AsyncAppWithState.
Implementations§
Source§impl<S> AsyncResource<S>
impl<S> AsyncResource<S>
Sourcepub fn name(self, name: &str) -> AsyncResource<S>
pub fn name(self, name: &str) -> AsyncResource<S>
The route names’ prefix (default: the path’s last segment).
Sourcepub fn guard<G>(self, guard: G) -> AsyncResource<S>
pub fn guard<G>(self, guard: G) -> AsyncResource<S>
Run guard before every route of this resource.
Sourcepub fn index<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn index<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
GET /posts: the list.
Sourcepub fn new_form<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn new_form<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
GET /posts/new: the form for a new one.
Sourcepub fn create<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn create<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
POST /posts: create one.
Sourcepub fn show<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn show<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
GET /posts/{id}: one.
Sourcepub fn edit<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn edit<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
GET /posts/{id}/edit: the form to change one.
Sourcepub fn update<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn update<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
PUT and PATCH /posts/{id}: change one.
Sourcepub fn destroy<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn destroy<F, Fut>(self, handler: F) -> AsyncResource<S>where
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
DELETE /posts/{id}: delete one.
Sourcepub fn extra(
self,
build: impl FnOnce(AsyncGroup<S>) -> AsyncGroup<S>,
) -> AsyncResource<S>
pub fn extra( self, build: impl FnOnce(AsyncGroup<S>) -> AsyncGroup<S>, ) -> AsyncResource<S>
More routes under the resource’s path, with its guards.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for AsyncResource<S>
impl<S> !UnwindSafe for AsyncResource<S>
impl<S> Forget for AsyncResource<S>
impl<S> Freeze for AsyncResource<S>
impl<S> Send for AsyncResource<S>
impl<S> Sync for AsyncResource<S>
impl<S> Unpin for AsyncResource<S>
impl<S> UnsafeUnpin for AsyncResource<S>where
AsyncGroup<S>: UnsafeUnpin,
Vec<(&'static str, &'static str, &'static str, Arc<dyn Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Pin<Box<dyn Future<Output = Response> + Send>> + 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 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