[][src]Trait dropshot::Extractor

pub trait Extractor: Send + Sync + Sized {
#[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
;
fn metadata() -> Vec<ApiEndpointParameter>; }

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, 

Construct an instance of this type from a RequestContext.

fn metadata() -> Vec<ApiEndpointParameter>

Loading content...

Implementations on Foreign Types

impl Extractor for ()

impl<T1: Extractor + 'static> Extractor for (T1,)[src]

impl<T1: Extractor + 'static, T2: Extractor + 'static> Extractor for (T1, T2)[src]

impl<T1: Extractor + 'static, T2: Extractor + 'static, T3: Extractor + 'static> Extractor for (T1, T2, T3)[src]

Loading content...

Implementors

impl<BodyType> Extractor for TypedBody<BodyType> where
    BodyType: JsonSchema + DeserializeOwned + Send + Sync + 'static, 
[src]

impl<PathType> Extractor for Path<PathType> where
    PathType: DeserializeOwned + JsonSchema + Send + Sync + 'static, 
[src]

impl<QueryType> Extractor for Query<QueryType> where
    QueryType: JsonSchema + DeserializeOwned + Send + Sync + 'static, 
[src]

Loading content...