rust-lang / futures-rs

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

Document cancel safety of `StreamExt::next` #2701

Open bonsairobo opened 1 year ago

bonsairobo commented 1 year ago

Here: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html#method.next

And the equivalent tokio docs: https://docs.rs/tokio-stream/latest/tokio_stream/trait.StreamExt.html#method.next

I think it's critical that users know if stream items can be accidentally dropped if the future is cancelled.

taiki-e commented 1 year ago

I would accept a PR to document this.