Crate body_image_futio[−][src]
Expand description
Asynchronous HTTP integration for body-image.
The body-image-futio crate integrates body-image with futures, http, hyper, and tokio 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()
functions, as well as a RequestRecorder
implementation for
hyper::Body
(its “default” http_body::Body
type).
Structs
Adaptor for BodyImage
, implementing the futures::Stream
and
http_body::Body
traits.
Adaptor for BodySink
, implementing the futures::Sink
trait.
Extends AsyncBodyImage
by further dispatching any blocking file read
operations to a blocking_permit::DispatchPool
registered with the
current thread.
Extends AsyncBodySink
by further dispatching any blocking file write
operations to a blocking_permit::DispatchPool
registered with the
current thread.
An additional set of tuning constants for asynchronous I/O, extending the
body_image::Tunables
set.
A builder for FutioTunables
.
A lenient arbiter that always allows blocking.
Extends AsyncBodyImage
by acquiring a blocking permit before performing
any blocking file read operations.
Extends AsyncBodySink
by acquiring a blocking permit before performing
any blocking file write operations.
An http::Request
and recording.
A stateful arbiter that records the need to block and grants one-time allowances.
Provides zero-copy read access to both Bytes
and memory mapped regions
(MemMapBuf
). Implements bytes::Buf
(mmap feature only).
Enums
All possible states of a BlockingArbiter
.
The policy for blocking operations.
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
Appropriate value for the HTTP accept-encoding request header, including (br)otli when the brotli feature is configured.
A browser-like HTTP accept request header value, with preference for hypertext.
The crate version string.
Traits
Trait for arbitration of where blocking operations are acceptable to the runtime.
Trait qualifying Sink<Item>
buffer requirements.
Trait qualifying Stream
Item-type buffer requirments.
Extension trait for http::request::Builder
, to enable recording key
portions of the request for the final Dialog
.
Trait for generic construction of Sink
wrapper types.
Trait for generic construction of Stream
wrapper types.
Functions
Decode the response body of the provided Dialog
compressed with any
supported Encoding
, updated the dialog accordingly.
Run an HTTP request to completion, returning the full Dialog
.
Return true if the chunked Transfer-Encoding can be found in the headers.
Return a list of relevant encodings from the headers Transfer-Encoding and Content-Encoding.
Given a suitable hyper::Client
and RequestRecord
, return a
Future
with Dialog
output.
Return a generic HTTP user-agent header value for the crate, with version
Type Definitions
Conveniently compact type alias for dyn Trait std::error::Error
.
Extends AsyncBodyImage
by splitting buffers and yielding.
Extends AsyncBodyImage
by periodically yielding.