heph
heph copied to clipboard
Add rpc::all function
Goals:
- Minimal number of wakeups of the caller (ideally only 1 when all calls have return or errored).
- Minimal amount of allocations.
API idea
/// Run multple RPCs concurrently.
fn all<I, Res>(rpc: I) -> Res
where
I: ExactSizeIterator<RPC<T>>,
Res: FromIterator<Result<T, SendError>>,
{
// ...
}
Specially design task::Waker
implementation that only wakes if all responses are ready, or if one errored (?).
Waker called:
- If message not yet send -> wake to send message.
- If message is already send -> don't wake, mark the message as ready to receive.