From 5f39c5492e18a4ccd448bae3c5c188dbde8620be Mon Sep 17 00:00:00 2001 From: pearzl <302669696@qq.com> Date: Wed, 22 Oct 2025 23:47:37 +0800 Subject: [PATCH] Add Body::try_clone default method --- http-body/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/http-body/src/lib.rs b/http-body/src/lib.rs index 0470906..1d1e538 100644 --- a/http-body/src/lib.rs +++ b/http-body/src/lib.rs @@ -85,6 +85,16 @@ pub trait Body { fn size_hint(&self) -> SizeHint { SizeHint::default() } + + /// Attempt to clone this body if the concrete type supports it. + /// + /// The default implementation returns `None` to indicate cloning is not supported. + fn try_clone(&self) -> Option + where + Self: Sized, + { + None + } } impl Body for &mut T {