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

Add opposite of stream_reader #2705

Closed
Darksonn opened this issue Jul 28, 2020 · 1 comment · Fixed by #2714
Closed

Add opposite of stream_reader #2705

Darksonn opened this issue Jul 28, 2020 · 1 comment · Fixed by #2714
Labels
A-tokio Area: The main tokio crate A-tokio-util Area: The tokio-util crate C-feature-accepted Category: A feature request that has been accepted pending implementation. C-feature-request Category: A feature request. M-codec Module: tokio-util/codec M-io Module: tokio/io

Comments

@Darksonn
Copy link
Contributor

The tokio::io::stream_reader adapter allows you to convert a Stream<Item=Result<Bytes, Error>> into an AsyncRead. I would like to provide an adapter for the opposite conversion as well.

It is currently already possible to do this using

FramedRead::new(my_async_read, BytesCodec::new()).map_ok(BytesMut::freeze)

from tokio-util, but this is such a common operation that I think we should provide a dedicated adapter in tokio::io as well.

Name suggestion: stream_chunker

@Darksonn Darksonn added E-help-wanted Call for participation: Help is requested to fix this issue. E-easy Call for participation: Experience needed to fix: Easy / not much A-tokio-util Area: The tokio-util crate A-tokio Area: The main tokio crate M-io Module: tokio/io C-feature-request Category: A feature request. M-codec Module: tokio-util/codec C-feature-accepted Category: A feature request that has been accepted pending implementation. labels Jul 28, 2020
@taiki-e
Copy link
Member

taiki-e commented Sep 19, 2020

Done in #2714 / #2788. (seems pr to non-default branch doesn't close issue)

@taiki-e taiki-e closed this as completed Sep 19, 2020
@Darksonn Darksonn removed E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. labels Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate A-tokio-util Area: The tokio-util crate C-feature-accepted Category: A feature request that has been accepted pending implementation. C-feature-request Category: A feature request. M-codec Module: tokio-util/codec M-io Module: tokio/io
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants