Skip to content

Oneshot is_ready#152557

Open
connortsui20 wants to merge 2 commits intorust-lang:mainfrom
connortsui20:oneshot-is-ready
Open

Oneshot is_ready#152557
connortsui20 wants to merge 2 commits intorust-lang:mainfrom
connortsui20:oneshot-is-ready

Conversation

@connortsui20
Copy link
Contributor

Tracking Issue: #143674

Adds a is_ready method to the oneshot::Receiver.

This also changes the internal mutex for the mpmc::zero flavor implementation to use the nonpoison::Mutex since every lock call simply unwraps. Please let me know if that is out of the scope of this change.

There's also one small unfortunate implementation detail, see comments below.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet

Comment on lines +283 to +286
/// Returns `true` when the channel is disconnected.
pub(crate) fn is_disconnected(&self) -> bool {
self.inner.lock().is_disconnected
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's somewhat unfortunate that this has to take the lock. I believe it might be possible to outline the is_disconnected flag as an atomic bool outside of the lock, but that might not be worth the extra complexity.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 20, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@joboet
Copy link
Member

joboet commented Feb 20, 2026

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 20, 2026
@rustbot rustbot assigned the8472 and unassigned joboet Feb 20, 2026
@rustbot

This comment has been minimized.

@connortsui20
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 22, 2026
@rust-log-analyzer

This comment has been minimized.

Adds an `is_ready` method to `oneshot::Receiver` that allows a user to
see if a value has been sent over the channel.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants