summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJuan Cruz Viotti <jv@jviotti.com>2021-01-21 20:07:34 -0400
committerGitHub <noreply@github.com>2021-01-21 16:07:34 -0800
commit4aff1198dd72b4c79652d0c42fbb1dfa2e21afa9 (patch)
tree8f69f5ad7424a534276f0e8a21827e235f2146e1 /docs
parentad3a729f967d3651f80cc89a9315eff964f865d8 (diff)
downloadflatbuffers-4aff1198dd72b4c79652d0c42fbb1dfa2e21afa9.tar.gz
flatbuffers-4aff1198dd72b4c79652d0c42fbb1dfa2e21afa9.tar.bz2
flatbuffers-4aff1198dd72b4c79652d0c42fbb1dfa2e21afa9.zip
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>
Diffstat (limited to 'docs')
-rw-r--r--docs/source/Internals.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/source/Internals.md b/docs/source/Internals.md
index 389a8f9e..882cde8b 100644
--- a/docs/source/Internals.md
+++ b/docs/source/Internals.md
@@ -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