[−][src]Trait dropshot::Extractor
Extractor
defines an interface allowing a type to be constructed from a
RequestContext
. Unlike most traits, Extractor
essentially defines only a
constructor function, not instance functions.
The extractors that we provide (Query
, Path
, TypedBody
) implement
Extractor
in order to construct themselves from the request. For example,
Extractor
is implemented for Query<Q>
with a function that reads the
query string from the request, parses it, and constructs a Query<Q>
with
it.
We also define implementations of Extractor
for tuples of types that
themselves implement Extractor
. See the implementation of
HttpRouteHandler
for more on why this needed.
Required methods
#[must_use]fn from_request<'async_trait>(
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<Self, HttpError>> + Send + 'async_trait>> where
Self: 'async_trait,
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<Self, HttpError>> + Send + 'async_trait>> where
Self: 'async_trait,
Construct an instance of this type from a RequestContext
.
fn metadata() -> Vec<ApiEndpointParameter>
Implementations on Foreign Types
impl Extractor for ()
fn from_request<'async_trait>(
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(), HttpError>> + Send + 'async_trait>>
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(), HttpError>> + Send + 'async_trait>>
fn metadata() -> Vec<ApiEndpointParameter>
impl<T1: Extractor + 'static> Extractor for (T1,)
[src]
fn from_request<'async_trait>(
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(T1,), HttpError>> + Send + 'async_trait>>
[src]
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(T1,), HttpError>> + Send + 'async_trait>>
fn metadata() -> Vec<ApiEndpointParameter>
[src]
impl<T1: Extractor + 'static, T2: Extractor + 'static> Extractor for (T1, T2)
[src]
fn from_request<'async_trait>(
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(T1, T2), HttpError>> + Send + 'async_trait>>
[src]
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(T1, T2), HttpError>> + Send + 'async_trait>>
fn metadata() -> Vec<ApiEndpointParameter>
[src]
impl<T1: Extractor + 'static, T2: Extractor + 'static, T3: Extractor + 'static> Extractor for (T1, T2, T3)
[src]
fn from_request<'async_trait>(
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3), HttpError>> + Send + 'async_trait>>
[src]
_rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3), HttpError>> + Send + 'async_trait>>
fn metadata() -> Vec<ApiEndpointParameter>
[src]
Implementors
impl<BodyType> Extractor for TypedBody<BodyType> where
BodyType: JsonSchema + DeserializeOwned + Send + Sync + 'static,
[src]
BodyType: JsonSchema + DeserializeOwned + Send + Sync + 'static,
fn from_request<'async_trait>(
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<TypedBody<BodyType>, HttpError>> + Send + 'async_trait>>
[src]
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<TypedBody<BodyType>, HttpError>> + Send + 'async_trait>>
fn metadata() -> Vec<ApiEndpointParameter>
[src]
impl<PathType> Extractor for Path<PathType> where
PathType: DeserializeOwned + JsonSchema + Send + Sync + 'static,
[src]
PathType: DeserializeOwned + JsonSchema + Send + Sync + 'static,
fn from_request<'async_trait>(
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<Path<PathType>, HttpError>> + Send + 'async_trait>>
[src]
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<Path<PathType>, HttpError>> + Send + 'async_trait>>
fn metadata() -> Vec<ApiEndpointParameter>
[src]
impl<QueryType> Extractor for Query<QueryType> where
QueryType: JsonSchema + DeserializeOwned + Send + Sync + 'static,
[src]
QueryType: JsonSchema + DeserializeOwned + Send + Sync + 'static,
fn from_request<'async_trait>(
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<Query<QueryType>, HttpError>> + Send + 'async_trait>>
[src]
rqctx: Arc<RequestContext>
) -> Pin<Box<dyn Future<Output = Result<Query<QueryType>, HttpError>> + Send + 'async_trait>>