To a novice like me they seem to be interchangeable. I can only guess that tokio's channels could be better for async somehow. But that's just me taking a shot in the dark. Looking to get some info about the differences from the experts. Thanks
The difference is that the Tokio channel is asynchronous. This means that send
and recv
are async functions that must be awaited for you to call them, meaning that they can only be used in async code. The crossbeam channel is not async, and its send
and recv
methods will block instead. You cannot use crossbeam in async code due to the issues described in this article.
If you are sending messages between async and non-async code, then Tokio's documentation explains what you should do. Read about that here.
5 Likes
This is helpful. Thanks!
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.