Skip to content

stream: coordinating Tokio 1.0 with the availability of Stream in std #2870

@carllerche

Description

@carllerche

Currently, Tokio uses the Stream trait provided by futures-core. There is an ongoing effort to define a Stream trait within std. Tokio is currently aiming to release 1.0 by the end of the year. Given the Rust release cadence, Stream may not be available in std on the stable channel by the end of the year.

If Stream is not available on the Rust stable channel by the end of the year, we have two options.

  1. Delay Tokio 1.0 until Stream becomes available in std.
  2. Remove Stream usage from Tokio until 6 months after it becomes available in std (due to the proposed MSRV policy).

Stream usage

Currently, Stream is implemented in Tokio by:

  • mpsc::Receiver
  • broadcast::Receiver
  • signal::Signal

Tokio also provides a tokio::stream module containing a number of useful stream utilities. A list can be found here.

Removing the Stream dependency

If Stream is removed from the tokio crate, it can be placed temporarily in the tokio-util crate. This crate is not intended to reach 1.0 by the end of year. Stream usage within Tokio is already isolated via the stream feature flag. While useful, it is not a critical dependency.

Removing Stream from tokio would impact the discoverability of the utilities. This could be mitigated by including an empty tokio::stream module with documentation explaining where to find the utilities.

Adding Stream post 1.0

Adding Stream after an initial 1.0 release would take at least 6 months given the currently proposed MSRV policy (#2718). According to the policy, 1.x releases are permitted to increase the MSRV, but must support all Rust versions released in the past 6 months.

Next steps

I will leave this open-ended for now as we collect comments. We can then decide on the direction we want to take.

Metadata

Metadata

Assignees

Labels

A-tokioArea: The main tokio crateC-proposalCategory: a proposal and request for commentsM-streamModule: tokio/stream

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions