tokio::select! how to handle multiple branch. #4222
-
|
Hi, tokio::select! need to declare all async operations at the compile time. I want like FD_SET in C. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
If you have a variable number of streams, then you shouldn't be using
The difference between option 2 and 3 is whether it tells you which receiver the message came from. |
Beta Was this translation helpful? Give feedback.
-
|
If the futures all have the same output type, there is the |
Beta Was this translation helpful? Give feedback.
If you have a variable number of streams, then you shouldn't be using
select!. Here are some other options:tokio_stream::StreamMap.futures::stream::SelectAll.The difference between option 2 and 3 is whether it tells you which receiver the message came from.