Why is there no spmc (single producer multiple consumer) in tokio?

I recently started using tokio - Rust and wondered why there is no spmc channel.
There is watch channel but it can only store 1 value.
Is broadcast channel fine for this or is it better to use another crate for spmc ?

There's no reason to make an spmc channel if you can make an mpmc channel that is just as efficient. Using broadcast is fine if broadcasting is the behavior you are looking for.

If you want an mpmc channel where only one receiver receives each message, then use the async-channel crate.

4 Likes

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.