[−][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]
type Future = ExtractBytes<Self, B>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(ctx: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for u8
[src]
type Future = Immediate<u8>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for u16
[src]
type Future = Immediate<u16>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for u32
[src]
type Future = Immediate<u32>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for u64
[src]
type Future = Immediate<u64>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for i8
[src]
type Future = Immediate<i8>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for i16
[src]
type Future = Immediate<i16>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for i32
[src]
type Future = Immediate<i32>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<B: BufStream> Extract<B> for i64
[src]
type Future = Immediate<i64>
fn extract(ctx: &Context) -> Self::Future
[src]
fn extract_body(context: &Context, body: B) -> Self::Future
[src]
fn requires_body(callsite: &CallSite) -> bool
[src]
impl<T, B: BufStream> Extract<B> for Option<T> where
T: Extract<B>,
[src]
T: Extract<B>,