rust-lang / futures-rs

Zero-cost asynchronous programming in Rust
https://rust-lang.github.io/futures-rs/
Apache License 2.0
5.34k stars 616 forks source link

Use `Waker::will_wake()` to avoid a cloning op #2723

Closed daxpedda closed 1 year ago

daxpedda commented 1 year ago

This uses Waker::will_wake() to check if the old waker will awaken the same task as the new one, which could save a clone operation.

This is analogous to https://github.com/smol-rs/atomic-waker/pull/12.