-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add core::stream::Stream
#79023
Add core::stream::Stream
#79023
Conversation
oh, I just realized the RFC already sets a feature name: |
Updated with @taiki-e's feedback! |
@yoshuawuyts: I think you missed #79023 (comment). |
Technically this should probably be reviewed by someone in the @rust-lang/compiler area, since we're supposed to be managing the actual implementation. I'm going to put r? @tmandry |
Ping @tmandry; if you have time, a review on this would be great! |
LGTM, but @nikomatsakis did you want to wait for @tmandry to get a chance to review as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few documentation nits. Great docs by the way :)
I've also implemented @camelid's feedback, and resolved the other remaining comments on this PR. This should be ready for review by the libs team. |
Updated with @camelid's feedback on the docs! |
The job Click to see the possible cause of the failure (guessed by this bot)
|
This is a temporary change only, as we wait to resolve dynamic dispatch issues. The `Stream::next` method and corresponding documentation are expected to be fully restored once we have a path to proceed. Ref: rust-lang/rfcs#2996 (comment) update docs
Looks like we're good to go here! @bors r+ |
📌 Commit a1b1132 has been approved by |
Rollup of 16 pull requests Successful merges: - rust-lang#79023 (Add `core::stream::Stream`) - rust-lang#80562 (Consider Scalar to be a bool only if its unsigned) - rust-lang#80886 (Stabilize raw ref macros) - rust-lang#80959 (Stabilize `unsigned_abs`) - rust-lang#81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`) - rust-lang#81409 (Slight simplification of chars().count()) - rust-lang#81468 (cfg(version): treat nightlies as complete) - rust-lang#81473 (Warn write-only fields) - rust-lang#81495 (rustdoc: Remove unnecessary optional) - rust-lang#81499 (Updated Vec::splice documentation) - rust-lang#81501 (update rustfmt to v1.4.34) - rust-lang#81505 (`fn cold_path` doesn't need to be pub) - rust-lang#81512 (Add missing variants in match binding) - rust-lang#81515 (Fix typo in pat.rs) - rust-lang#81519 (Don't print error output from rustup when detecting default build triple) - rust-lang#81520 (Don't clone LLVM submodule when download-ci-llvm is set) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
[Tracking issue: #79024]
This patch adds the
core::stream
submodule and implementscore::stream::Stream
in accordance with RFC2996. The RFC hasn't been merged yet, but as requested by the libs team in rust-lang/rfcs#2996 (comment) I'm filing this PR to get the ball rolling.Documentatation
The docs in this PR have been adapted from
std::iter
,async_std::stream
, andfutures::stream::Stream
. Once this PR lands my plan is to follow this up with PRs to add helper methods such asstream::repeat
which can be used to document more of the concepts that are currently missing. That will allow us to cover concepts such as "infinite streams" and "laziness" in more depth.Feature gate
The feature gate for
Stream
isstream_trait
. This matches the#[lang = "future_trait"]
attribute name. The intention is that only the APIs defined in RFC2996 will use this feature gate, with future additions such asstream::repeat
using their own feature gates. This is so we can ensure a smooth path towards stabilizing theStream
trait without needing to stabilize all the APIs incore::stream
at once. But also don't start expanding the API until after stabilization, as was the case withstd::future
.edit: the feature gate has been changed to
async_stream
to match the feature gate proposed in the RFC.Conclusion
This PR introduces
core::stream::{Stream, Next}
and re-exports it fromstd
asstd::stream::{Stream, Next}
. LandingStream
in the stdlib has been a mult-year process; and it's incredibly exciting for this to finally happen!r? @KodrAus
cc/ @rust-lang/wg-async-foundations @rust-lang/libs