You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you suggesting that watch::Sender::send should be consuming like oneshot::Sender::send? In one of my projects, I'm using watch over broadcast because I only need the most recent value (I'm sending time-sensitive but loss-permissive signals from a 'master' task to several other tasks), but I can't use oneshot because I need to send multiple values.
I'd like to propose an alternative that won't break current uses of either channel type, but still allows each channel type to fill its niche: making oneshot be single-producer multi-consumer. This can be accomplished by adding oneshot::Sender::subscribe and/or impl<T> Clone for oneshot::Receiver<T>.
@donnellycolton I think you may have got the wrong idea?
One thing that would be useful is if there were convenience methods that made it act more like a Cell. For example, methods to access the value from the Sender side so you don't have to store an extra copy.
Tracks breaking changes to
sync::watch
Now that
broadcast
exists,watch
should be specialized to track a single value. The API should be made more consistent with other channels.Receiver::recv()
can just returnT
.Sender
should havesend
fn and notbroadcast
.The text was updated successfully, but these errors were encountered: