Expand description
MessageSet wire format helpers (legacy Google-internal encoding).
Enabled per-message via option message_set_wire_format = true on a
proto2 message with no fields, only extensions N to M;. Each extension
is encoded as a group at field 1 containing type_id = 2 (the extension’s
field number) and message = 3 (the extension’s payload bytes):
tag(1, SGROUP) | tag(2, Varint) | <type_id> | tag(3, LD) | len | <payload> | tag(1, EGROUP)instead of the regular tag(type_id, LD) | len | <payload>.
Storage is non-MessageSet: an unknown item with type_id = T and
payload V is stored in UnknownFields as
{ number: T, data: LengthDelimited(V) }, not as a group. Decode unwraps
the group into that form; encode rewraps it. This mirrors protobuf-go.
Constants§
- ITEM_
END_ TAG - Field 1, wire type
EndGroup(4):(1 << 3) | 4. - ITEM_
START_ TAG - Field 1, wire type
StartGroup(3):(1 << 3) | 3. - MESSAGE_
TAG - Field 3, wire type
LengthDelimited(2):(3 << 3) | 2. - TYPE_
ID_ TAG - Field 2, wire type
Varint(0):(2 << 3) | 0.
Functions§
- item_
encoded_ len - Encoded length of one MessageSet
Itemwrappingpayload_lenbytes at extension fieldnumber. - merge_
item - Parse one MessageSet
Itemgroup body (betweenSGROUPandEGROUP).