Explain how FlatBuffers encodes unions (#6414)

This is an attempt to explain how FlatBuffers encodes union types as an
extra section in the "FlatBuffers internals" document.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
Juan Cruz Viotti
2021-01-21 20:07:34 -04:00
committed by GitHub
parent ad3a729f96
commit 4aff1198dd

View File

@@ -111,6 +111,13 @@ is 0, that means the field is not present in this object, and the
default value is return. Otherwise, the entry is used as offset to the
field to be read.
### Unions
Unions are encoded as the combination of two fields: an enum representing the
union choice and the offset to the actual element. FlatBuffers reserves the
enumeration constant `NONE` (encoded as 0) to mean that the union field is not
set.
### Strings and Vectors
Strings are simply a vector of bytes, and are always