From 7a1d401937671679e742baed5bc7b30725d2150e Mon Sep 17 00:00:00 2001 From: Vivian Dike Date: Sun, 13 Sep 2026 21:22:25 +0100 Subject: [PATCH] docs(examples): document hyper-util dependency and TokioIo usage Examples in this repository use an internal benches/support module to avoid a cyclical workspace dependency on hyper-util. When users copy these examples into their own standalone projects, they encounter missing imports for TokioIo and TokioTimer. This adds hyper-util to the list of dependencies and explains how to import TokioIo and TokioTimer from hyper_util::rt. Closes #3448 --- examples/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/README.md b/examples/README.md index de38911e9c..c2fba6e7e2 100644 --- a/examples/README.md +++ b/examples/README.md @@ -13,6 +13,7 @@ A complete list of dependencies used across these examples: ```toml [dependencies] hyper = { version = "1", features = ["full"] } +hyper-util = { version = "0.1", features = ["full"] } tokio = { version = "1", features = ["full"] } pretty_env_logger = "0.5" http-body-util = "0.1" @@ -24,6 +25,24 @@ http = "1" futures-util = { version = "0.3", default-features = false } ``` +### Using Examples in Your Own Project + +When copying code from these examples into your own standalone project, note that +the examples in this repository import an internal support module (`#[path = "../benches/support/mod.rs"]`) +to avoid a cyclical workspace dependency on `hyper-util`. + +In your own application, add `hyper-util` to your `Cargo.toml`: + +```toml +hyper-util = { version = "0.1", features = ["tokio"] } +``` + +And import `TokioIo` and `TokioTimer` directly from `hyper_util::rt`: + +```rust +use hyper_util::rt::{TokioIo, TokioTimer}; +``` + ## Getting Started ### Clients