Closed jnhyatt closed 1 year ago
since I was expecting dropping all receivers to result in any sent messages simply being cast into the void, and then picked up again when a receiver was created.
Not if you read the docs. :)
There was a similar request not too long ago (#34) and it ended up with https://github.com/smol-rs/async-broadcast/pull/36. I think you can make use of that with inactive receiver concept to achieve your goals.
Sender
has a public APInew_receiver
that allows forReceiver
s to be created without cloning an existingReceiver
. This means that if allReceiver
s are dropped and thennew_receiver
is called, the channel will only giveClosed
results forsend
andrecv
. This is surprising behavior since I was expecting dropping all receivers to result in any sent messages simply being cast into the void, and then picked up again when a receiver was created.If this is intentional, I'm curious what the reason for this design is. At the least I'd expect a closed channel to be reopenable by creating new
Receiver
s. What's the reasoning behind the current API, and could it change to either option presented here?