mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
10b7e468f3
Add `task::Waker::noop` 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`](https://docs.rs/futures/0.3/futures/task/fn.noop_waker.html) and [`futures::task::noop_waker_ref`](https://docs.rs/futures/0.3/futures/task/fn.noop_waker_ref.html) Tracking issue: https://github.com/rust-lang/rust/issues/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 |
||
---|---|---|
.. | ||
alloc | ||
backtrace@4245978ca8 | ||
core | ||
panic_abort | ||
panic_unwind | ||
portable-simd | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@7e2cdc675b | ||
sysroot | ||
test | ||
unwind |