Is Future::race in async_std equivalent to select! in Tokio?

Is Future::race in async_std equivalent to select! in Tokio?

If yes, why does Tokio implement it by macro, while async_std implements it by normal method?

It does seem to be equivalent, yes. One reason why select!() might be a macro is that it isn't limited to 2 futures, so it can wait for one of any number of futures.

The tokio::select! macro can do a lot more things than the race method can.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.