bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Working with more complex types is difficult

Open petreeftime opened this issue 6 years ago • 1 comments

I'm trying to make some structures serialize into bytes in a nice way. However, these types contain both optional data and maps of bytes (Option<Vec<u8>> and BTreeMap<usize, Vec<u8>>). #[serde(with = "serde_bytes")] doesn't seem capable of dealing with these types. I've found a way to make them work by changing the types to Option<ByteBuf> and BTreeMap<usize, ByteBuf>, but it adds quite a lot of extra glue code. Is there a nicer way to achieve this?

petreeftime avatar Jul 12 '19 09:07 petreeftime

This seems like a question for the serde repository rather than the bytes repository I think?

sfackler avatar Sep 09 '19 20:09 sfackler