anza-xyz / anza-xyz/wincode

Support strict map/set decoding

Đang mở
#429 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
227
Fork
46
Merge trung bình
7 ngày 15 giờ
Pull request đã merge (30 ngày)
4

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

The issue concerns map and set deserialization plus a new boolean option in Config. Start by locating the Config definitions and the map/set decoding paths, then inspect nearby duplicate-handling tests if present. Done means strict decoding rejects duplicate keys or values only when enabled, while the default behavior remains unchanged.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
backend
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
58/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.