[−][src]Trait tower_web::extract::Extract
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
type Future: ExtractFuture<Item = Self>
The future representing the completion of the extraction logic.
Required Methods
fn extract(context: &Context) -> Self::Future
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
fn extract_body(context: &Context, body: B) -> Self::Future
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.
fn requires_body(callsite: &CallSite) -> bool
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 Vec<u8>type Future = ExtractBytes<Self, B>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(ctx: &Context, body: B) -> Self::Future[src]
fn extract_body(ctx: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for u8[src]
impl<B: BufStream> Extract<B> for u8type Future = Immediate<u8>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for u16[src]
impl<B: BufStream> Extract<B> for u16type Future = Immediate<u16>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for u32[src]
impl<B: BufStream> Extract<B> for u32type Future = Immediate<u32>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for u64[src]
impl<B: BufStream> Extract<B> for u64type Future = Immediate<u64>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for i8[src]
impl<B: BufStream> Extract<B> for i8type Future = Immediate<i8>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for i16[src]
impl<B: BufStream> Extract<B> for i16type Future = Immediate<i16>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for i32[src]
impl<B: BufStream> Extract<B> for i32type Future = Immediate<i32>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for i64[src]
impl<B: BufStream> Extract<B> for i64type Future = Immediate<i64>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<T, B: BufStream> Extract<B> for Option<T> where
T: Extract<B>, [src]
impl<T, B: BufStream> Extract<B> for Option<T> where
T: Extract<B>, type Future = ExtractOptionFuture<T::Future>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for PathBuf[src]
impl<B: BufStream> Extract<B> for PathBuftype Future = Immediate<Self>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for String[src]
impl<B: BufStream> Extract<B> for Stringtype Future = Immediate<Self>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolimpl<B: BufStream> Extract<B> for OsString[src]
impl<B: BufStream> Extract<B> for OsStringtype Future = Immediate<Self>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> boolImplementors
impl<B: BufStream> Extract<B> for HttpDateTime[src]
impl<B: BufStream> Extract<B> for HttpDateTimetype Future = Immediate<HttpDateTime>
fn extract(ctx: &Context) -> Self::Future[src]
fn extract(ctx: &Context) -> Self::Futurefn extract_body(context: &Context, body: B) -> Self::Future[src]
fn extract_body(context: &Context, body: B) -> Self::Futurefn requires_body(callsite: &CallSite) -> bool[src]
fn requires_body(callsite: &CallSite) -> bool