From 74bd472097a30ca182a3169740a5450ed78f8cfb Mon Sep 17 00:00:00 2001 From: lihan3238 Date: Fri, 8 May 2026 16:41:31 +0800 Subject: [PATCH] docs(client): document Drop behavior for Connection types Explain what happens when Connection is dropped: the underlying IO resource is closed and in-flight requests are interrupted. Suggest polling to completion for graceful shutdown. Closes #3192 --- src/client/conn/http1.rs | 7 +++++++ src/client/conn/http2.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/client/conn/http1.rs b/src/client/conn/http1.rs index 85c1fdc665..696aa005b3 100644 --- a/src/client/conn/http1.rs +++ b/src/client/conn/http1.rs @@ -50,6 +50,13 @@ pub struct Parts { /// can process incoming and outgoing messages, notice hangups, and the like. /// /// Instances of this type are typically created via the [`handshake`] function +/// +/// # Drop behavior +/// +/// Dropping the `Connection` will close the underlying IO resource. +/// Any in-flight requests that have not received a response will be +/// interrupted. If graceful shutdown is desired, poll the connection +/// until it completes instead of dropping. #[must_use = "futures do nothing unless polled"] pub struct Connection where diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index e29e678b57..d62b4a4e99 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -39,6 +39,13 @@ impl Clone for SendRequest { /// can process incoming and outgoing messages, notice hangups, and the like. /// /// Instances of this type are typically created via the [`handshake`] function +/// +/// # Drop behavior +/// +/// Dropping the `Connection` will close the underlying IO resource. +/// Any in-flight requests that have not received a response will be +/// interrupted. If graceful shutdown is desired, poll the connection +/// until it completes instead of dropping. #[must_use = "futures do nothing unless polled"] pub struct Connection where