Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement packed fields #377

Open
tristantarrant opened this issue Dec 4, 2024 · 0 comments
Open

Implement packed fields #377

tristantarrant opened this issue Dec 4, 2024 · 0 comments

Comments

@tristantarrant
Copy link
Member

Quoting the protobuf docs:

repeated fields of a primitive type (any scalar type that is not string or bytes) can be declared as “packed”. In proto2 this is done using the field option [packed=true]. In proto3 it is the default.

Instead of being encoded as one record per entry, they are encoded as a single LEN record that contains each element concatenated. To decode, elements are decoded from the LEN record one by one until the payload is exhausted. The start of the next element is determined by the length of the previous, which itself depends on the type of the field.

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

No branches or pull requests

1 participant