diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-01-30 13:36:39 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-30 13:36:39 +0900 |
| commit | ecd7cb1c3ab5d7e7b10f934a561b8a6958bcd1b0 (patch) | |
| tree | c7c78e7cdb916b46f283ddf2a5994723536c7291 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs | |
| parent | 0248c6f178ab3a4d2ec702b7d418ff8375ab0515 (diff) | |
| parent | a1b11321fb2d6ce00af9c8957c98df76432b1b78 (diff) | |
| download | rust-ecd7cb1c3ab5d7e7b10f934a561b8a6958bcd1b0.tar.gz rust-ecd7cb1c3ab5d7e7b10f934a561b8a6958bcd1b0.zip | |
Rollup merge of #79023 - yoshuawuyts:stream, r=KodrAus
Add `core::stream::Stream`
[[Tracking issue: #79024](https://github.com/rust-lang/rust/issues/79024)]
This patch adds the `core::stream` submodule and implements `core::stream::Stream` in accordance with [RFC2996](https://github.com/rust-lang/rfcs/pull/2996). The RFC hasn't been merged yet, but as requested by the libs team in https://github.com/rust-lang/rfcs/pull/2996#issuecomment-725696389 I'm filing this PR to get the ball rolling.
## Documentatation
The docs in this PR have been adapted from [`std::iter`](https://doc.rust-lang.org/std/iter/index.html), [`async_std::stream`](https://docs.rs/async-std/1.7.0/async_std/stream/index.html), and [`futures::stream::Stream`](https://docs.rs/futures/0.3.8/futures/stream/trait.Stream.html). Once this PR lands my plan is to follow this up with PRs to add helper methods such as `stream::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` is `stream_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 as `stream::repeat` using their own feature gates. This is so we can ensure a smooth path towards stabilizing the `Stream` trait without needing to stabilize all the APIs in `core::stream` at once. But also don't start expanding the API until _after_ stabilization, as was the case with `std::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 from `std` as `std::stream::{Stream, Next}`. Landing `Stream` 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`````
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions
