don't automatically wrap in RumaResponse

This allows us to use the `ruma_route` convenience function even when we
need to add our own hacks into the responses, thus making us less
reliant on Ruma.
This commit is contained in:
Charles Hall 2024-05-18 18:31:36 -07:00
parent 87ac0e2a38
commit 230ebd3884
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
35 changed files with 438 additions and 405 deletions

View file

@ -579,11 +579,13 @@ macro_rules! impl_ruma_handler {
( $($ty:ident),* $(,)? ) => {
#[axum::async_trait]
#[allow(non_snake_case)]
impl<Req, E, F, Fut, $($ty,)*> RumaHandler<($($ty,)* Ruma<Req>,)> for F
impl<Req, Resp, E, F, Fut, $($ty,)*>
RumaHandler<($($ty,)* Ruma<Req>,)> for F
where
Req: IncomingRequest + Send + 'static,
Resp: IntoResponse,
F: FnOnce($($ty,)* Ruma<Req>) -> Fut + Clone + Send + 'static,
Fut: Future<Output = Result<Req::OutgoingResponse, E>>
Fut: Future<Output = Result<Resp, E>>
+ Send,
E: IntoResponse,
$( $ty: FromRequestParts<()> + Send + 'static, )*
@ -600,7 +602,7 @@ macro_rules! impl_ruma_handler {
on(
method_filter,
|$( $ty: $ty, )* req| async move {
handler($($ty,)* req).await.map(RumaResponse)
handler($($ty,)* req).await
}
)
)