Replies: 1 comment 1 reply
-
What you're experiencing is a property of Rust: you need to be explicit about your return type. When you need to be able to return multiple different types, there's two main ways to that in Rust: using an
It's up to you to decide which fits your needs better. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to implement a routing mechanism. The current code is as follows and it works well.
But I encountered a problem:
The hyper interface requires the return value type to be Result<Response<Full>, ..> or Result<Response<BoxedBody>, ..> or other
It seems that the return value cannot be defined as Result<Response,...>. If I want to return StreamBody, I need to modify the return value type, but then I cannot use the router mechanism.
Please tell me what the solution is.
Function you want to achieve:
Beta Was this translation helpful? Give feedback.
All reactions