jam.utils.codec.composite.arrays module
Array codec implementation for JAM specification.
Arrays are encoded by concatenating their encoded elements with no length prefix. The length is known at compile-time in Rust; in Python we enforce it at runtime. Maximum array size is 1000 elements as per specification.
- class jam.utils.codec.composite.arrays.ArrayCodec(length: int)[source]
Bases:
Codec[Sequence[Codable]]Codec for fixed-length arrays/sequences.
Arrays are encoded by concatenating their encoded elements in order. The length is fixed and known at encoding/decoding time.
- MAX_SIZE = 1000
- encode_size(value: Sequence[Codable]) int[source]
Calculate the number of bytes needed to encode the value.