Module hyper_util
Runtime glue, a pooling client, and server helpers for hyper.
- Crate
::hyper_util. - docs.rs
- crates.io
- GitHub
hyper 1.x is runtime-agnostic:
it reads and writes through its own I/O traits
and spawns tasks through an executor trait,
but provides no implementations of either.
hyper-util provides them for tokio,
along with the higher-level pieces that hyper 1.0
moved out of its core.
The parts used most:
TokioIo- adapts atokiosocket to hyper's I/O traitsTokioExecutor- spawns hyper's background tasks ontokioClient- a connection-pooling HTTP clientauto::Builder- serves a connection as HTTP/1 or HTTP/2, whichever the client speaksTowerToHyperService- runs atowerservice as a hyper service
Most applications should use reqwest as a client,
which is built on hyper-util.
Use hyper-util directly alongside hyper
when building servers or custom clients.
Message bodies come from http_body_util.
Examples
Serving a connection with hyper and requesting it with Client:
use Bytes;
use ;
use ;
use Client;
use ;
use Infallible;
use TcpListener;
async
async