In rust, I am trying to fulfill a future by extracting two bits of data out of a .get
request using a hyper client as a tuple. The problem is the resulting type doesn't work.
So given some code like this:
let result = client
.get(url)
.map_err(|err| Error::from(err))
.and_then(|response| {
(response
.into_body()
.concat2()
.map(|body| String::from_utf8(body.to_vec()).unwrap())
.map_err(|err| Error::from(err)),
response
.headers()
.get(CONTENT_TYPE)
.map(|content_type| content_type.to_str()))
});
I am getting an error like the trait "futures::IntoFuture" is not implemented for
...
I am pretty sure that it is because the two members of the tuple are futures and can be dealt with, but a tuple isn't, but I am not sure how to resolve the values of the futures and place them into a tuple.