Working with more complex types is difficult
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 384
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining how #[serde(with = "serde_bytes")] handles Option<Vec> and BTreeMap<usize, Vec>, comparing that behavior with the ByteBuf workaround described in the issue. Determine whether a less intrusive representation can support both optional byte data and maps of byte vectors, then verify the resulting serialization behavior for both types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100