rust-lang / futures-rs

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

Reusing `AbortRegistration` #2850

Open ilammy opened 5 months ago

ilammy commented 5 months ago

How to reuse AbortRegistration for multiple futures?

I have a future that I want to make Abortable. When that future completes, I need to make a new one and have it abortable as well, by the same AbortHandle.

One way would be to wrap this control sequence into another future and wrap that in Abortable. But it's not always convenient.

Would it be possible to impl Clone for AbortRegistration? That way, any number of tasks can be made Abortable via the same AbortHandle.