Structs: WStruct
fid 0 is reserved, that is the stop field. so don't use it, ever!
foreach field of struct x with fid => field.ordinal, wtBytes => wt(field.type), and encoded=> enc(field.value)
((uvar(fid)<<3) | wtBytes) ~ encoded
SVarInt: WSVarInt
svar(x)
Fixed64: WFixed64
fixed64(x)
OneOf: WOneOf
uvar(keyId) ~ uvar(wt) ~ encoded(x)
Strings: WByteArray
uvar(len(x)) ~ bytes(x)
Lists: WList
if len(xs) == 0
uvar(0)
else
uvar(len(xs)) ~ wt(xs.elem) ~ rep1(for( x <- xs) yield encoded(x))
Options: WList, same as list but it's length is 0 or 1 only
File format:
Structs: WStruct fid 0 is reserved, that is the stop field. so don't use it, ever! foreach field of struct x with fid => field.ordinal, wtBytes => wt(field.type), and encoded=> enc(field.value) ((uvar(fid)<<3) | wtBytes) ~ encoded SVarInt: WSVarInt svar(x) Fixed64: WFixed64 fixed64(x) OneOf: WOneOf uvar(keyId) ~ uvar(wt) ~ encoded(x) Strings: WByteArray uvar(len(x)) ~ bytes(x) Lists: WList if len(xs) == 0 uvar(0) else uvar(len(xs)) ~ wt(xs.elem) ~ rep1(for( x <- xs) yield encoded(x)) Options: WList, same as list but it's length is 0 or 1 only