You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current hacks essentially unwrap and panic at various locations.
Instead it would be good to use appropriate result types.
It might be best to support only async traits that exclusively use results as return values (even for Unit returns) in their methods. Otherwise there is sort of a symmetry break when going from async trait to service back to async trait. One can see this in the generated blanket implementations let response = self.call(#request_ident::#variant_ident {#(#args),*}).await.unwrap();. Where instead of unwrapping, an error from the tower.call invocation should be mapped to the async trait result type instead.
The text was updated successfully, but these errors were encountered:
Another option would be to simply modify the trait to wrap the return values into Resultsimilar as async_trait turns them into Pin<Box<Future...>>. That would however also require putting the #[tower_service] on the trait implementation to achieve the same transformation there.
The current hacks essentially
unwrap
andpanic
at various locations.Instead it would be good to use appropriate result types.
It might be best to support only async traits that exclusively use results as return values (even for Unit returns) in their methods. Otherwise there is sort of a symmetry break when going from async trait to service back to async trait. One can see this in the generated blanket implementations
let response = self.call(#request_ident::#variant_ident {#(#args),*}).await.unwrap();
. Where instead of unwrapping, an error from the tower.call invocation should be mapped to the async trait result type instead.The text was updated successfully, but these errors were encountered: