class Garzon(h.Struct): arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True) nested_vla_len = h.UInt16() nested_vla = h.Vector(field_type=h.Int32(), length=nested_vla_len, value=(9, 10, 100)) x = h.UInt8(5)
class Ronen(h.Struct): x = h.UInt8(2) arr = h.Array(10, h.FieldPlaceholder, value=list(range(10))) @h.Struct.from_bytes_hook(arr) def foo(self): self.arr.type = h.UInt16()
class Shine(h.Struct): arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True) vec_len = h.UInt8() vec = h.Vector(field_type=h.UInt8(), length=vec_len) y = h.UInt64(9) z_len = h.UInt8() z = h.Vector(field_type=Garzon(), length=z_len, value=[ Garzon(nested_vla=(11, 12, 13, 14, 15)), Garzon(arr=(9,)), Garzon()]) vec2_len = h.UInt8() vec2 = h.Vector(field_type=h.UInt32(), length=vec2_len, value=(53, 99, 123)) x = h.UInt16(104)
class Hand(h.Struct): cards = h.Array(5, Card)
class C(h.Struct): x = h.Array(5) y = h.UInt8
class Lior(h.Struct): a = h.Array(5, fill=True)
class T(h.Struct): x = h.InclusiveLengthField(h.UInt8) y = h.Array(10, fill=True)
class Shustin2(h.Struct): arr = h.Array(3, h.UInt8(8), validator=lambda x: x > 9, fill=True)
class Isaac(h.Struct): arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True) x = h.UInt8(5)
class Data(h.Struct): data = h.Array(10)
class Yakov(h.Struct): arr = h.Array(3)
class Raif(h.Struct): a = h.Array(5, h.UInt16(1))
class Raif(h.Struct): a = h.Array(5, h.UInt16(), fill=True)
class Lior(h.Struct): a = h.Array(5, h.UInt16, fill=True)
class Good(h.Struct): i32 = h.Int32(5, validator=lambda z: z > 4) i32_range = h.Int32(14, validator=range(0, 30, 2)) i32_set = h.Int32(2, validator={1, 2, 3}) i32_arr = h.Array(length=5, field_type=h.UInt8(5), validator=5)