smol-rs / async-broadcast

Async broadcast channels
Apache License 2.0
163 stars 26 forks source link

`Sender::broadcast` now returns `Send<'static>` #40

Closed zeenix closed 1 year ago

zeenix commented 1 year ago

The static lifetime allows the Send to be kept around in the same place/type as Sender w/o running into self-reference issues.

Since the inner struct is in an Arc, cloning is cheap and this change doesn't affect the performance of Sender::broadcast.

We could just drop the lifetime parameter entirely at this point but let's keep it for backwards compatibility.

Fixes #39.

zeenix commented 1 year ago

Converting to draft until we can be certain this is really justified.

zeenix commented 1 year ago

Closing this. See discussion in #39 for reasons.