@Count decorator defines a variable-length array based on a value you pass as argument.
@Count
This decorator is useful for dynamic parsing of arrays when the length is not fixed but can be derived from another property.
The type of the class the decorator is applied to.
The type of the decorated property.
The number of time to read the target property or a string referring to a property that specifies the array length.
Optional
Optional configuration.
The property decorator function.
In the following example, the @Count decorator is used to define an array (vec) whose length is determined by the value of another property (len):
vec
len
class Protocol { @Relation(PrimitiveSymbol.u8) len: Number @Count('len') @Relation(PrimitiveSymbol.u8) vec: Number} Copy
class Protocol { @Relation(PrimitiveSymbol.u8) len: Number @Count('len') @Relation(PrimitiveSymbol.u8) vec: Number}
@Count
decorator defines a variable-length array based on a value you pass as argument.This decorator is useful for dynamic parsing of arrays when the length is not fixed but can be derived from another property.