From e79d09396da955f235c267832312543d8230d867 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Thu, 6 May 2021 22:48:53 +0200 Subject: [PATCH] docs(client): document the guarantees of cloning a `Client` (#2540) Small docs improvement to mention that cloning a `Client` is cheap and will reuse the connection pool. Fixes https://github.com/hyperium/hyper/issues/2239 --- src/client/client.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/client.rs b/src/client/client.rs index a219eb14..5545eab9 100644 --- a/src/client/client.rs +++ b/src/client/client.rs @@ -19,6 +19,9 @@ use crate::common::{exec::BoxSendFuture, lazy as hyper_lazy, task, Future, Lazy, use crate::rt::Executor; /// A Client to make outgoing HTTP requests. +/// +/// `Client` is cheap to clone and cloning is the recommended way to share a `Client`. The +/// underlying connection pool will be reused. #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))] pub struct Client { config: Config,