-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add task::Waker::noop
#96875
Add task::Waker::noop
#96875
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Could you open a new tracking issue? https://togithub.com/rust-lang/rust/issues/98262 is a good example. |
@m-ou-se ping from triage, no movement for 11 months. What is the status of this PR? |
@bors r+ |
#[must_use] | ||
#[unstable(feature = "noop_waker", issue = "98286")] | ||
pub const fn noop() -> Waker { | ||
const VTABLE: RawWakerVTable = RawWakerVTable::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make this a static
such that the vtable is shared between all times RawWaker
is codegened?
☀️ Test successful - checks-actions |
Finished benchmarking commit (10b7e46): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 647.662s -> 647.017s (-0.10%) |
I have found myself reimplementing this function many times when I need a
Context
but don't have a runtime orfutures
to hand.Prior art:
futures::task::noop_waker
andfutures::task::noop_waker_ref
Tracking issue: #98286
Unresolved questions:
RawWaker::noop()
? (I don't think so, I can't think of a use case for it)Context::noop()
? Depending on the future directionContext
goes a "noop context" might not even make sense in future.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