From 7585f6c96b3b166dae37653e77d524d6a0177531 Mon Sep 17 00:00:00 2001 From: totodore Date: Tue, 19 May 2026 10:44:35 +0200 Subject: [PATCH] feat(derive): impl `IntoResponse` on &T --- api-error-derive/src/expand.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api-error-derive/src/expand.rs b/api-error-derive/src/expand.rs index 6e8de38..eeab368 100644 --- a/api-error-derive/src/expand.rs +++ b/api-error-derive/src/expand.rs @@ -55,6 +55,14 @@ pub fn expand(input: DeriveInput) -> TokenStream { .unwrap_or(::api_error::axum::default_error_responder)(&self) } } + + #[automatically_derived] + impl #impl_generics ::api_error::axum::__axum_core::response::IntoResponse for &#ident #ty_generics #where_clause { + fn into_response(self) -> ::api_error::axum::__axum_core::response::Response { + ::api_error::axum::__ERROR_RESPONDER.get().copied() + .unwrap_or(::api_error::axum::default_error_responder)(self) + } + } }); #[cfg(not(feature = "axum"))]