> It's easy to read, isn't?
pub fn try_join<A, B, AR, BR, E>(a: A, b: B) -> impl Future<Output = Result<(AR, BR), E>>
where
A: Future<Output = Result<AR, E>>,
B: Future<Output = Result<BR, E>>,
Come on... "A", "B", "E", "a", "b"??? Naming stuff like this is the standard way? I mean, if I know nothing about what the code does, and I find this kind of function, I'll start swearing right away.
Also, the function only does:
TryJoin::Polling {
a: State::Future(a),
b: State::Future(b),
}
Which is clearer and shorter. Why even writing a function signature like that? It's longer and more complicated to understand than the code itself! I don't know much Rust, but since a semicolon is missing this is just a return value, right?
So why not?
let res = TryJoin::Polling {
a: State::Future(fetch_thing("first")),
b: State::Future(fetch_thing("second")),
}.await?
PS: I don't want to criticize, and I'm not a Rust literate, I'm just amazed with its complexity.