From 4618f98825866e529ef3c999a4d302cdb6674d4a Mon Sep 17 00:00:00 2001 From: DoumanAsh Date: Sat, 4 Jul 2026 14:34:17 +0900 Subject: [PATCH] impl HttpError::new_boxed to provide user with ability to ctor from already boxed error --- src/client/http/connection.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/client/http/connection.rs b/src/client/http/connection.rs index c7cd2c14..0558a7e1 100644 --- a/src/client/http/connection.rs +++ b/src/client/http/connection.rs @@ -81,10 +81,13 @@ impl HttpError { where E: Error + Send + Sync + 'static, { - Self { - kind, - source: Box::new(e), - } + Self::new_boxed(kind, Box::new(e)) + } + + #[inline] + /// Create a new [`HttpError`] with provided `source` error + pub fn new_boxed(kind: HttpErrorKind, source: Box) -> Self { + Self { kind, source } } #[cfg(feature = "reqwest")]