anza-xyz / anza-xyz/wincode

Support strict map/set decoding

Open
#429 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
224
Forks
46
Avg merge
7d 15h
Merged PRs (30d)
4

Description

Deserializing a map or set type (e.g., `HashMap`, `HashSet`) ignores duplicate keys during deserialization -- i.e., multiple `insert`s on the same key simply overwrite the previous value. For certain use-cases, it may be preferable to return an error if the sequence of values being deserialized into a map or set contains duplicates, which I'll refer to as _strict decoding_. I do not believe this strict decoding behavior is the right default, as all sequences in wincode use the same encoding format, and it is perfectly reasonable for someone to deserialize a set of values serialized as a `Vec` into a `HashSet` if one wanted to, for example, explicitly de-dupe that sequence.

To support this, we can add a `Config` boolean constant (something like `STRICT_MAP_SET`) to allow users to opt into this behavior.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.