Open yoshuawuyts opened 10 months ago
// most traits like this
impl<A: Future, B: Future> Race for (A, B) {
async fn race(self) -> (A::Output, B::Output) ;
}
// but `Join` should be like this...
impl<A: Future, B: Future> Join for (A, B) {
type Future = impl Future<Output = (A::Output, B::Output)>;
fn join(self) -> Self::Future;
}
// ... so that we can implement it in std like this
impl<A: Future, B: Future> IntoFuture for (A, B) {
type IntoFuture = impl Future<Output = (A::Output, B::Output)>;
fn into_future(self) -> Self:: IntoFuture;
}
Now that async traits are stable, we may want to consider filing a patch to use them. Not sure yet if we should merge it, but we should at least try it out.
For
Join
it should not be an AFIT, but instead use animpl Future
as its associated type.