nscn.polaris2.pdefgen

Members list

Value members

Concrete methods

def pdefEnum[E <: Enum](values: Array[E]): Codec[E]

Codec for a pdef enum: the case's ordinal in a single unsigned byte.

Codec for a pdef enum: the case's ordinal in a single unsigned byte.

Takes the enum's values, which Scala 3 keeps in ordinal order, so the generated code reads pdefEnum(titanClasses.values).

Attributes

def pdefEnumMap[K <: Enum, V](keys: Array[K], codecV: Codec[V]): Codec[Map[K, V]]

Codec for T name[SomeEnum] - a dense array with one V per case of K, laid out in ordinal order and surfaced as a Map[K, V].

Codec for T name[SomeEnum] - a dense array with one V per case of K, laid out in ordinal order and surfaced as a Map[K, V].

Attributes

def pdefString(size: Int): Codec[String]

Codec for string{size}: exactly size bytes of NUL-padded UTF-8.

Codec for string{size}: exactly size bytes of NUL-padded UTF-8.

size is a count of BYTES, not bits: string{16} occupies exactly 16 bytes on the wire. Encoding right-pads with NUL to that width and fails if the text does not fit; decoding takes the full width and stops at the first NUL.

Attributes

Concrete fields

val pdefBool: Codec[Boolean]

Codec for bool: one byte, written as 0x00 or 0x01.

Codec for bool: one byte, written as 0x00 or 0x01.

Not scodec's bool(8), which writes true as all-ones (0xff). Decoding is just as permissive - any non-zero byte is true - but a decode/encode round trip has to put 0x01 back where it found it, or editing one field of a record rewrites every true in it.

Attributes