Skip to content

Newtype is not defaulting to transparent and is wrapping with an array #6

@gpeacock

Description

@gpeacock

Problem

Given a newtype struct wrapping a HashMap:

pub struct MyStruct(pub HashMap<String, ByteBuf>);

The library is incorrectly serializing it as a 1-element array containing a map (CBOR major type 4), rather than transparently as just the map itself (CBOR major type 5).

Before fix:

  • CBOR output: [129, 162, ...] = 0x81 (array with 1 element) + 0xA2 (map with 2 entries)
  • Major type: 4 (array) ❌

Expected:

  • CBOR output: [162, ...] = 0xA2 (map with 2 entries)
  • Major type: 5 (map) ✓

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions