Trait tower_web::extract::Extract[][src]

pub trait Extract<B: BufStream>: 'static + Sized {
    type Future: ExtractFuture<Item = Self>;
    fn extract(context: &Context) -> Self::Future;

    fn extract_body(context: &Context, body: B) -> Self::Future { ... }
fn requires_body(callsite: &CallSite) -> bool { ... } }

Extract a value from an HTTP request.

The extracted value does not need to be produced immediately. Implementations of Extract are able to perform asynchronous processing.

The trait is generic over B: BufStream, which represents the HTTP request body stream.

Associated Types

The future representing the completion of the extraction logic.

Required Methods

Extract the argument from the HTTP request.

This function is not provide the HTTP request body. Implementations of this function must ensure that the request HEAD (request URI and headers) are sufficient for extracting the value.

Provided Methods

Extract the argument using the HTTP request body.

Doing so will usually involve deserializing the contents of the HTTP request body to the target value being extracted.

Returns true if extracting the type requires body.

Only a single resource method argument may extract using the HTTP request body. This function allows enforcing this requirement.

Implementations on Foreign Types

impl<B: BufStream> Extract<B> for Vec<u8>
[src]

impl<B: BufStream> Extract<B> for u32
[src]

impl<T, B: BufStream> Extract<B> for Option<T> where
    T: Extract<B>, 
[src]

impl<B: BufStream> Extract<B> for PathBuf
[src]

impl<B: BufStream> Extract<B> for String
[src]

Implementors