use std::{ future::Future, pin::Pin, task::{Context, Poll}, }; use futures::{stream, StreamExt}; pub struct JoinHandle(T); impl Future for JoinHandle { type Output = Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { loop {} } } pub fn spawn(future: T) -> JoinHandle { loop {} } fn main() { let bodies = stream::iter([]) .map(|url: String| spawn(async { Result::Ok(url) })) .buffer_unordered(0); bodies.for_each(|b| async { match b { Ok(Ok(url)) => {} Err(e) => {} Ok(Err(e)) => {} } }); }