Add a WeakSender type
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
The mpsc module should have a sender type that holds a weak reference to the channel. A WeakSender is to a Sender what a sync::Weak is to a sync::Arc. The channel will close if all Senders are dropped even if the Receiver is still alive.
The API for this could look similar to the Arc API. Just add a method Sender::downgrade(self) -> WeakSender<T>. This should be easy to implement given that Sender currently uses an Arc internally to hold it's reference to the channel.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by locating the mpsc implementation and its Sender's internal Arc, then compare the proposed API with sync::Arc and sync::Weak. Done means Sender::downgrade produces WeakSender, and the channel closes after all Sender values are dropped even while the Receiver remains alive; verify both behaviors with tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100