(initial: Value)
| 21 | pub(crate) const CLOSED: usize = 0; |
| 22 | |
| 23 | pub(crate) fn channel(initial: Value) -> (Sender, Receiver) { |
| 24 | debug_assert!(initial != CLOSED, "watch::channel initial state of 0 is reserved"); |
| 25 | |
| 26 | let shared = Arc::new(Shared { |
| 27 | value: AtomicUsize::new(initial), |
| 28 | waker: AtomicWaker::new(), |
| 29 | }); |
| 30 | |
| 31 | (Sender { shared: shared.clone() }, Receiver { shared }) |
| 32 | } |
| 33 | |
| 34 | pub(crate) struct Sender { |
| 35 | shared: Arc<Shared>, |