From b378fb283f37640ca05f790de7279b363ecefe88 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 13 Oct 2022 11:44:54 +0200 Subject: [PATCH] Add Error::into_inner (#1476) --- axum-core/CHANGELOG.md | 2 ++ axum-core/src/error.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/axum-core/CHANGELOG.md b/axum-core/CHANGELOG.md index 52a5204c..84673d69 100644 --- a/axum-core/CHANGELOG.md +++ b/axum-core/CHANGELOG.md @@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased - **added:** Add `DefaultBodyLimit::max` for changing the default body limit ([#1397]) +- **added:** Add `Error::into_inner` for converting `Error` to `BoxError` without allocating ([#1476]) [#1397]: https://github.com/tokio-rs/axum/pull/1397 +[#1476]: https://github.com/tokio-rs/axum/pull/1476 # 0.3.0-rc.2 (10. September, 2022) diff --git a/axum-core/src/error.rs b/axum-core/src/error.rs index f5788034..8c522c72 100644 --- a/axum-core/src/error.rs +++ b/axum-core/src/error.rs @@ -14,6 +14,11 @@ impl Error { inner: error.into(), } } + + /// Convert an `Error` back into the underlying boxed trait object. + pub fn into_inner(self) -> BoxError { + self.inner + } } impl fmt::Display for Error {