Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame^] | 1 | package flatbuffers |
2 | |||||
3 | // FlatBuffer is the interface that represents a flatbuffer. | ||||
4 | type FlatBuffer interface { | ||||
5 | Table() Table | ||||
6 | Init(buf []byte, i UOffsetT) | ||||
7 | } | ||||
8 | |||||
9 | // GetRootAs is a generic helper to initialize a FlatBuffer with the provided buffer bytes and its data offset. | ||||
10 | func GetRootAs(buf []byte, offset UOffsetT, fb FlatBuffer) { | ||||
11 | n := GetUOffsetT(buf[offset:]) | ||||
12 | fb.Init(buf, n+offset) | ||||
13 | } |