mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00

traits into `Codec` A previous commit refactored such that `Encode` and `Decode` are implemented directly on the types being encoded or decoded. This was thought to be less expressive but more convenient than having a separate notion of a (stateful) encoder or decoder. However, there are certain situations where the approach is just too limiting: you're required to implemented `Decode` and `Encode` for types you don't "own" and can't newtype. This commit moves back to a setup where `Self` represents the encoder/decoder state; it also merges the two traits into a single `Codec` trait, since they are currently always used together.