Module body_image::async [−][src]
Asynchronous HTTP integration and utilities.
This optional module (via default async feature) provides additional integration with the futures, http, hyper 0.12.x., and tokio crates.
-
Trait
RequestRecorder
extendshttp::request::Builder
for recording aRequestRecord
of varous body types, which can then be passed torequest_dialog
orfetch
. -
The
fetch
function runs aRequestRecord
and returns a completedDialog
using a single-use client and runtime forrequest_dialog
. -
The
request_dialog
function returns aFuture<Item=Dialog>
, given a suitablehyper::Client
reference andRequestRecord
. This function is thus more composable for complete tokio applications. -
AsyncBodySink
adapts aBodySink
for asynchronous input from a (e.g.hyper::Body
)Stream
. -
AsyncBodyImage
adapts aBodyImage
for asynchronous output as aStream
andhyper::body::Payload
. -
Alternatively,
UniBodySink
andUniBodyImage
offer zero-copyMemMap
support, using the customUniBodyBuf
item buffer type (instead of thehyper::Chunk
orBytes
). -
The
decode_res_body
and associated functions will decompress any supported Transfer/Content-Encoding of the response body and update theDialog
accordingly.
Structs
AsyncBodyImage |
Adaptor for |
AsyncBodySink |
Adaptor for |
RequestRecord |
An |
UniBodyBuf |
Provides zero-copy read access to both |
UniBodyImage |
Adaptor for |
UniBodySink |
Adaptor for |
Statics
ACCEPT_ENCODINGS |
Appropriate value for the HTTP accept-encoding request header, including (br)otli when the brotli feature is configured. |
BROWSE_ACCEPT |
A browser-like HTTP accept request header value, with preference for hypertext. |
Traits
RequestRecorder |
Extension trait for |
Functions
decode_res_body |
Decode the response body of the provided |
decompress |
Decompress the provided body of any supported compression |
fetch |
Run an HTTP request to completion, returning the full |
find_chunked |
Return true if the chunked Transfer-Encoding can be found in the headers. |
find_encodings |
Return a list of supported encodings from the headers Transfer-Encoding
and Content-Encoding. The |
request_dialog |
Given a suitable |
user_agent |
Return a generic HTTP user-agent header value for the crate, with version |