casey / casey/x-serialization-format

Table allocation

Open
#57 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

Many things conspire to make this tricky:

1. Any table field can be omitted
2. Tables encoding should be canonical
3. Tables are encoded as length-prefixed array of offsets to fields

Some possible solutions:

- Users must declare up-front how many fields they will encode. Tables are encoded as a packed array of `(index, offset)` tuples. Accessing a table requires doing a binary search on the index.

- Users must declare up-front the index of the last field they will encode. Tables are encoded as an array of `offsets`, with zero-offsets for missing entries. Accessing a table requires checking the length, so that you know how many fields are present. Fields that would be past the end of the array are considered to be missing.

- Buffers are allocated back to front, so the table can be allocated after the fields are allocated, so you don't need to know how many fields are present up front.

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.