1 //! Somse utilities to make working with std Futures easier
4 use core::future::Future;
5 use core::marker::Unpin;
7 use core::task::{Context, Poll};
9 pub(crate) struct MultiFuturePoller<F: Future<Output = ()> + Unpin>(pub Vec<Option<F>>);
11 impl<F: Future<Output = ()> + Unpin> Future for MultiFuturePoller<F> {
13 fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
14 let mut have_pending_futures = false;
15 for fut_option in self.get_mut().0.iter_mut() {
16 let mut fut = match fut_option.take() {
20 match Pin::new(&mut fut).poll(cx) {
21 Poll::Ready(()) => {},
23 have_pending_futures = true;
24 *fut_option = Some(fut);
28 if have_pending_futures {