2

Add `task::Waker::noop` by SabrinaJewson · Pull Request #96875 · rust-lang/rust...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/96875
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Contributor

I have found myself reimplementing this function many times when I need a Context but don't have a runtime or futures to hand.

Prior art: futures::task::noop_waker and futures::task::noop_waker_ref

Tracking issue: #98286

Unresolved questions:

  1. Should we also add RawWaker::noop()? (I don't think so, I can't think of a use case for it)
  2. Should we also add Context::noop()? Depending on the future direction Context goes a "noop context" might not even make sense in future.
  3. Should it be an associated constant instead? That would allow for let cx = &mut Context::from_waker(&Waker::NOOP); to work on one line which is pretty nice. I don't really know what the guideline is here.

r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs

a1phyr, Demindiro, goffrie, and Dirbaio reacted with thumbs up emojiSwatinem, yvt, and Demindiro reacted with heart emoji

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK