You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use debugger to debug my tool with try_join_all or other join functions in futures, I want to replace try_join_all with non-parallel versions for easy debugging.
I wrote helper functions like below but I wonder if some option to make join functions non-parallel.
async fn try_join_all<I>(iter: I) -> Result<Vec<<<I as IntoIterator>::Item as TryFuture>::Ok>, <<I as IntoIterator>::Item as TryFuture>::Error>
where
I: IntoIterator,
I::Item: TryFuture {
let mut vec = Vec::new();
for mut fut in iter {
let mut pinned = pin!(fut);
vec.push(std::future::poll_fn(|c| pinned.as_mut().try_poll(c)).await?);
}
Ok(vec)
}
async fn join_all<I>(iter: I) -> Vec<<<I as IntoIterator>::Item as Future>::Output>
where
I: IntoIterator,
I::Item: Future {
let mut vec = Vec::new();
for mut fut in iter {
let mut pinned = pin!(fut);
vec.push(pinned.as_mut().await);
}
vec
}
async fn join<A, B>(a: A, b: B) -> (<A as Future>::Output, <B as Future>::Output)
where A: Future, B: Future {
(a.await, b.await)
}
The text was updated successfully, but these errors were encountered:
When I use debugger to debug my tool with
try_join_all
or otherjoin
functions in futures, I want to replacetry_join_all
with non-parallel versions for easy debugging.I wrote helper functions like below but I wonder if some option to make join functions non-parallel.
The text was updated successfully, but these errors were encountered: