From a45d5d5a04369f93334fc893875d8d1a49054e04 Mon Sep 17 00:00:00 2001 From: Ruben2424 <61056653+Ruben2424@users.noreply.github.com> Date: Fri, 21 Jul 2023 20:53:44 +0200 Subject: [PATCH] docs(example): document the single-threaded example (#3271) --- examples/single_threaded.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/single_threaded.rs b/examples/single_threaded.rs index 5466251116..40e8d942b2 100644 --- a/examples/single_threaded.rs +++ b/examples/single_threaded.rs @@ -1,5 +1,15 @@ #![deny(warnings)] - +/// This example shows how to use hyper with a single-threaded runtime. +/// This example exists also to test if the code compiles when `Body` is not `Send`. +/// +/// This Example includes HTTP/1 and HTTP/2 server and client. +/// +/// In HTTP/1 it is possible to use a `!Send` `Body`type. +/// In HTTP/2 it is possible to use a `!Send` `Body` and `IO` type. +/// +/// The `Body` and `IOTypeNotSend` structs in this example are `!Send` +/// +/// For HTTP/2 this only works if the `Executor` trait is implemented without the `Send` bound. use http_body_util::BodyExt; use hyper::server::conn::http2; use std::cell::Cell;