Closed Einliterflasche closed 6 months ago
I think you can just use the either
crate in combination with or
to do this. For example:
let a = async { /* ... */ };
let b = async { /* ... */ };
let combo = async move { Either::Left(a.await) }.or(async move { Either::Right(b.await) });
match combo.await {
Either::Left(a) => /* ... */,
Either::Right(b) => /* ... */
}
True! thanks for the quick reply
Hey,
first of all, great work! I don't think the smol project get's enough recognition for its amazing work.
I learned from #65 that you have an
or
function which is likeselect!
except in that it requires both futures to have the same output type. Is there already a function likeor
which works for two futures with distinct output types and returns anEither
enum?If there is no such function as of yet I would like to try my hands at implementing it. I have thought of two issues:
Either
struct we would either (ba dum tsss) need to implement ourselves or depend on an an (albeit small)either
crate.I think this would be a very useful and straight forward addition.