Hyper
Low-level HTTP implementation for Rust providing client and server building blocks over HTTP/1 and HTTP/2.
Official Documentation ↗hyper 1.4 / Rust 1.63+. Check the official docs for the latest API surface.Installation
cargo add hyperMethods
No methods match this filter.
Overview
Hyper is the foundation of many Rust HTTP stacks. It implements HTTP/1 and HTTP/2 framing and connection handling, exposing low-level request and response types.
Core Methods
Serve connections with the http1 or http2 builders around an IO stream and a service function, and build clients with an executor. Request and Response builders construct and parse messages.
Usage Notes
Use Hyper directly when you need protocol control or are building a framework, and reach for axum or warp for routine applications. Keep services small and delegate routing upward.
Common Pitfalls
Managing connections, timeouts and graceful shutdown is your responsibility at this level. Forgetting to spawn tasks or drive the connection future leaves requests hanging. Body handling requires care with streaming.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://docs.rs/hyper/latest/hyper/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:20.102Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Any subsequent call on the same SendRequest returns a canceled error; the connection cannot be reused. (https://docs.rs/hyper/latest/hyper/)
- HTTP/2 resets the single stream with RST_STREAM ( CANCEL error code) and notifies the peer immediately rather than continuing to deliver a response body that would be discarded. (https://docs.rs/hyper/latest/hyper/)
- Downcasting error types from Error::source() is not considered stable. (https://docs.rs/hyper/latest/hyper/)
FAQ
- Is Hyper a full framework?
- No. Hyper is a low-level HTTP implementation. Frameworks like axum and warp build routing and ergonomics on top of it, while Hyper gives precise control over the protocol.
- How do I handle HTTP/1 versus HTTP/2?
- Use the http1 and http2 connection builders. With TLS and ALPN you can negotiate the protocol, or serve HTTP/2 directly for cleartext depending on configuration.
- What executor does Hyper use?
- Hyper 1.x is executor agnostic and needs an executor adapter such as Tokio for spawning. You pass a TokioExecutor when building clients.
Report a problem with this API docOpens a pre-filled issue on GitHub.