Skip to content
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

docs: add cancel-safety docs to StreamExt::next methods and types #4715

Merged
merged 1 commit into from May 27, 2022

Conversation

guswynn
Copy link
Contributor

@guswynn guswynn commented May 24, 2022

Motivation

Many futures are commonly used in select! (or similar) constructs, and people are interested to know which futures are cancel-safe. Two such common features are next and try_next, to get new values from a Stream. These only hold onto references to the underlying stream, and are therefor cancel-safe.

Solution

Document the cancel-safety of the StreamExt::next and StreamExt::try_next methods (and their underlying future types)

tokio-stream/src/stream_ext.rs Show resolved Hide resolved
@Darksonn Darksonn added T-docs Topic: documentation M-stream Module: tokio/stream A-tokio-stream Area: The tokio-stream crate labels May 25, 2022
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn merged commit 05cbfae into tokio-rs:master May 27, 2022
@guswynn guswynn deleted the stream-cancel-safe branch May 31, 2022 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-stream Area: The tokio-stream crate M-stream Module: tokio/stream T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants