blob: adfce52efe527c1f9c5ecbf9ee46ad9ffd03cb68 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001package flatbuffers
2
3// FlatBuffer is the interface that represents a flatbuffer.
4type 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.
10func GetRootAs(buf []byte, offset UOffsetT, fb FlatBuffer) {
11 n := GetUOffsetT(buf[offset:])
12 fb.Init(buf, n+offset)
13}