casey / casey/x-serialization-format

Default enum discriminant and table length

Open
#54 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Enums are encoded as a discriminant, followed by the variant. Tables are encoded as the number of fields, followed by offsets to those fields.

The encoding of the discriminant size and table length must be chosen up-front, limit the number of variants and fields, and cannot be changed in a backwards compatible fashion.

Arguments for different default enum discriminant and table length widths:

- Most all enums and tables will have less than 255 variants/fields, so the default should be u8. If anyone wants a bigger enum or table, they should plan ahead and use a u16.

- If u16 is the default, than tables and enums are only one byte bigger, and nobody will ever have to think about the limit, unless they want to save that byte.

- There should be no default, users should have to specify the type every time, so there are no surprises.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.