austinjones / postage-rs

The feature-rich, portable async channel library
MIT License
251 stars 9 forks source link

Implement subscribe() for watch channel #46

Closed loafofpiecrust closed 2 years ago

loafofpiecrust commented 2 years ago

Tokio's watch channel has a Sender::<T>::subscribe(&self) -> Receiver<T> function, allowing you to create new receivers from just a sender. This would make my uses of a watch channel simpler, while not having to pull in tokio as a library dependency. Since the watch channel state is held just by an Arc, I suspect this would be very straightforward to add.

Edit: I just noticed that you already have this subscribe() function for dispatch channels! So, very simple to add indeed.