postage-rs icon indicating copy to clipboard operation
postage-rs copied to clipboard

Clarify behaviour on drop of watch::Sender

Open ijackson opened this issue 1 year ago • 0 comments

The Sender isn't Clone so there can only be one. But, what happens if it's dropped?

The existence of Receiver::borrow implies that the contained value cannot be dropped until the last Receiver is dropped. (And, if it's not to be leaked, that's when it must be dropped.)

But what about the Stream impls? These all, ultimately, yield Option<T>. Does dropping the Sender cause a None (end of stream) indication, or does it just block forever? Should the Receiver impl FusedStream?

Knowing the answer to this might save us from wrapping up a watch in a contraption to ensure that receivers get notified of sender drop.

ijackson avatar Jul 19 '22 16:07 ijackson