[−][src]Crate body_image_futio
Asynchronous HTTP integration for body-image.
The body-image-futio crate integrates the body-image crate with futures, http, hyper, and tokio crates for both client and server use.
-
Trait
RequestRecorder
extendshttp::request::Builder
for recording aRequestRecord
of various 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
withDialog
output, given a suitablehyper::Client
reference andRequestRecord
. This function is thus more composable for complete tokio applications. -
AsyncBodyImage
adapts aBodyImage
for asynchronous output as aStream
andhttp_body::Body
. -
AsyncBodySink
adapts aBodySink
for asynchronous input from a (e.g.hyper::Body
)Stream
. -
The
decode_res_body
and associated functions will decompress any supported Transfer/Content-Encoding of the response body and update theDialog
accordingly.
Optional Features
The following features may be enabled or disabled at build time. All are enabled by default.
mmap: Adds zero-copy memory map support, via a UniBodyBuf
type usable
with all Stream
and Sink
types.
brotli: Adds the brotli compression algorithm to ACCEPT_ENCODINGS
and
decompression support in decode_res_body
.
hyper-http: Adds Hyper based fetch
and
request_dialog
methods, as well as a
RequestRecorder
implementation for
hyper::Body
(its "default" http_body::Body
type).
Structs
AsyncBodyImage | Adaptor for |
AsyncBodySink | Adaptor for |
DispatchBodyImage | Extends |
DispatchBodySink | Extends |
FutioTunables | An additional set of tuning constants for asynchronous I/O, extending the
body-image |
FutioTuner | A builder for |
LenientArbiter | A lenient arbiter that always allows blocking. |
PermitBodyImage | Extends |
PermitBodySink | Extends |
RequestRecord | An |
StatefulArbiter | A stateful arbiter that records the need to block and and grants one-time allowances. |
UniBodyBuf | Provides zero-copy read access to both |
Enums
Blocking | All possible states of a |
BlockingPolicy | The policy for blocking operations. |
FutioError | Error enumeration for body-image-futio origin errors. This may be extended in the future so exhaustive matching is gently discouraged with an unused variant. |
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. |
VERSION | The crate version string. |
Traits
BlockingArbiter | Trait for arbitration of where blocking operations are acceptable to the runtime. |
InputBuf | Trait qualifying |
OutputBuf | Trait qualifying |
RequestRecorder | Extension trait for |
SinkWrapper | Trait for generic construction of |
StreamWrapper | Trait for generic construction of |
Functions
decode_res_body | Decode the response body of the provided |
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 relevant 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 |
Type Definitions
Flaw | Conveniently compact type alias for dyn Trait |