I'm quite new to using futures and haven't used rust for over an year so quite a few things I have forgotten. I was hoping if someone can help me with what type I should put for the return statement of this:
fn process_response(&self, other: Other, mut response: reqwest::async::Response) -> () {
let future = response.json()
.map(|json| from_value::<MyType>(json).map(|mut my| {
my.other = other
my
}).ok());
future
}
The main goal is to perform the call to an http address async and after that parse the result by chaining the future into an instance of MyType and return basically a Result<MyType,Error> (after the future is done). However, the resulting type given by rust is:
futures::Map<impl futures::Future, [closure@src/test/test1.rs:54:18: 57:11 other:_]>
. Also if this is not the right way to do this please do let me know how to do it corretly.