tokio-rs/tokio-io

Add a way to override `decode_head` in `length_delimited::{FramedRead, FramedWrite}`

Closed this issue · 0 comments

Some formats (like golang's gob) encode the length. While one can reimplement the entirety of FramedRead and FramedWrite in such cases, the logic would largely overlap with what is in length_delimited. If there was an easy way to provide my own decode_head, I could use all the other length-delimited logic while encoding and decoding the encoded length.

Happy to whip up a PR if you agree this is a good idea...just let me know how you want me to go about doing so. If there is already a way to do this without reimplementing a ton of length_delimited logic, any pointers would be great!