Open
Description
Often I get compile errors when the compiler cannot deduce the type when using try_stream!
:
error[E0698]: type inside `async fn` body must be known in this context
--> src/server.rs:213:18
|
213 | let stream = try_stream! {
| __________________^
214 | | while let Some(chunk) = body.data().await {
215 | | let chunk = chunk?;
216 | | trace!("Body: {:?}", &chunk);
... |
219 | | }
220 | | };
| |_____^ cannot infer type for type parameter `E` declared on the enum `Result`
This can be resolved by moving the code into a function that returns the appropriate generic type. However, is it also possible to put a type annotation somewhere? (impl T
doesn't seem to work for annotating the type of a local variable.)
Metadata
Metadata
Assignees
Labels
No labels