Skip to content

Use Vec for Object and IObject, replacing ObjectKey#32

Merged
NicolasDP merged 1 commit into
primetype:masterfrom
dcSpark:object-as-vec
Jul 9, 2026
Merged

Use Vec for Object and IObject, replacing ObjectKey#32
NicolasDP merged 1 commit into
primetype:masterfrom
dcSpark:object-as-vec

Conversation

@SebastienGllmt

Copy link
Copy Markdown
Contributor

Currently ObjectKey doesn't support every cbor type (not even negative ints)

Instead of extending ObjectKey to support more types (it could be extended to support basically everything but floats), I think it makes more sense to just Value as they "key" for Object.

Switching from BTreeMapVec means we no longer have the sorting issue for float keys (so we can support all keys and not just some ObjectKey subset), and the fact that Vec can have duplicate keys is actually arguably correct because CBOR supports duplicate keys in maps

Note: this doesn't "drop" support for BTreeMap. If you don't want duplicate keys, you can still just do BTreeMap::deserialize. It will just silently use the last-wins first rule for map (which is what people tend to expect with maps anyways, even if cbor doesn't enforce this)

@NicolasDP NicolasDP merged commit 5a4ab67 into primetype:master Jul 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants