futures::Collect does not implement Future?

This seems very strange to me but recently I got the following error:

error[E0277]: the trait bound `futures::Collect<std::vec::Vec<impl futures::Future>>: std::future::Future` is not satisfied

which comes from a code that roughly looks like this:

pub async fn main() -> Result<(), ()> {
    let r: Vec<Vec<Futures>> = fetch_smth();
    for ri in r.into_iter() {
        let result = ::futures::future::join_all(ri).await?;
        println!("{:#?}", result);

What is the right way to actually absorb the future::Collect if not as a future?

What version of futures are you using? It looks like futures 0.1, in which case you will need to...

  1. pass a futures::Stream into futures::Collect
  2. convert from a futures::Future to a std::future::Future. (I am not well versed enough in futures to know how to do this bessides creating a Compat combinator)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.