moddef.codec.encode module

Point encoder (spec §10 inverse, §11.5). Port of go/codec/encode.go and moddef-ts encode.ts: composed values, register-field structs, and selector_ref remain read-oriented and are not supported for encode.

moddef.codec.encode.encode_point(p: Point, value: float | int | bool | str | bytes | Sequence[str] | datetime, ctx: Mapping[str, int] | None = None) list[int][source]

Serialize a typed value into register words per the point’s mapping.

moddef.codec.encode.point_words(p: Point) int[source]

Register count to read/write for p (mapping length or storage width).