encode and decode work on any type, chosen at compile time:
- built-in scalars,
Bool and String have fixed encodings (little-endian
fixed width; String is an 8-byte length then its UTF-8 bytes);
- arrow-mlake's
RecordBatch is an 8-byte length then one Arrow IPC stream
holding the schema and the batch, so columnar data crosses processes in
Arrow's own format;
- a type that conforms to
Codec encodes itself;
- any other struct is encoded field by field, in declaration order, by
reflection.
Built-ins are recognised by reflect[T].name(), because Int or String
can't adopt a dista trait. List and other generic containers aren't
supported: reflection can't recover their element type. Wrap them in a type
that implements Codec, or send columnar data as Arrow.
Both ends are the same binary, so there's no versioning or schema.