0

I have

futures: Vec<Box<dyn Future<Output = PendingTransaction<'a, ()>>>>,
...
let (res, idx, remaining_futures) = block_on(select_all(self.futures.into_iter().map(|x| &*x)));

It does not compile:

   Compiling server v0.1.0 (/home/porton/Projects/ubi-russia/private/server)
error[E0277]: the trait bound `&dyn core::future::future::Future<Output = ethers_providers::pending_transaction::PendingTransaction<'_, ()>>: core::future::future::Future` is not satisfied
   --> src/transactions.rs:102:73
    |
102 |                 let (res, idx, remaining_futures) = block_on(select_all(self.futures.into_iter().map(|x| &*x)));
    |                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::future::future::Future` is not implemented for `&dyn core::future::future::Future<Output = ethers_providers::pending_transaction::PendingTransaction<'_, ()>>`
    | 
   ::: /home/porton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/future/select_all.rs:35:20
    |
35  |           I::Item: Future + Unpin,
    |                    ------ required by this bound in `futures_util::future::select_all::select_all`

How to do this correctly?

Coder-256
  • 5,212
  • 2
  • 23
  • 51
porton
  • 5,214
  • 11
  • 47
  • 95

0 Answers0