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

Rename AsyncIterator back to Stream, introduce an AFIT-based AsyncIterator trait #119550

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Implement feedback from review
yoshuawuyts committed Jan 3, 2024
commit 0148977f9fd28722bb91ae9a1194d8e460681fb0
4 changes: 4 additions & 0 deletions library/core/src/async_iter/async_iter.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/// A trait for dealing with asynchronous iterators.
///
/// This trait is an alternative to the [`Stream`] trait. Both traits are
/// currently being evaluated on nightly with the intent to stabilize only one.
///
/// This is the main async iterator trait. For more about the concept of async iterators
/// generally, please see the [module-level documentation]. In particular, you
/// may want to know how to [implement `AsyncIterator`][impl].
///
/// [module-level documentation]: index.html
/// [impl]: index.html#implementing-async-iterator
/// [`Stream`]: crate::stream::Stream
#[unstable(feature = "async_iterator", issue = "79024")]
Copy link
Member Author

Choose a reason for hiding this comment

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

I've chosen to keep the same issue for both traits, but given them different feature gates. Since stabilizing one means not stabilizing the other, this seemed appropriate to me. Or should we open separate tracking issues for both traits?

#[must_use = "async iterators do nothing unless polled"]
#[doc(alias = "Stream")]
4 changes: 4 additions & 0 deletions library/core/src/stream/stream.rs
Original file line number Diff line number Diff line change
@@ -4,12 +4,16 @@ use crate::task::{Context, Poll};

/// A trait for dealing with asynchronous streams.
///
/// This trait is an alternative to the [`AsyncIterator`] trait. Both traits are
/// currently being evaluated on nightly with the intent to stabilize only one.
///
/// This is the main stream trait. For more about the concept of streams
/// generally, please see the [module-level documentation]. In particular, you
/// may want to know how to [implement `Stream`][impl].
///
/// [module-level documentation]: index.html
/// [impl]: index.html#implementing-async-stream
/// [`AsyncIterator`]: crate::async_iter::AsyncIterator
#[unstable(feature = "async_stream", issue = "79024")]
#[must_use = "streams do nothing unless polled"]
#[cfg_attr(not(bootstrap), lang = "async_stream")]