Skip to content

Add opposite of stream_reader #2705

@Darksonn

Description

@Darksonn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokioArea: The main tokio crateA-tokio-utilArea: The tokio-util crateC-feature-acceptedCategory: A feature request that has been accepted pending implementation.C-feature-requestCategory: A feature request.M-codecModule: tokio-util/codecM-ioModule: tokio/io

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions