Skip to content

API for chaining of tokio_util encoders and decoders #7455

Open
@tomDev5

Description

@tomDev5

In some scenarios, it's desirable to compose multiple encoders or decoders—for example, encoding a struct to JSON, then compressing and encrypting it, while also prepending a length field.

To support this use case, it would be useful to enable chaining decoders via a method like decoder_a.chain_decoder(decoder_b), producing a new decoder that applies both in sequence.

I've put together a small POC here: chained_codec
If this seems like a useful addition, I’d be happy to contribute it as a tokio_util feature. Let me know your thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokio-utilArea: The tokio-util crateC-feature-requestCategory: A feature request.M-codecModule: tokio-util/codec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions