KiwiCodec.Schema.Binary.TypeIndex (kiwi_codec v0.2.0)

Copy Markdown View Source

Encodes and decodes type references in Kiwi's compact binary schema format.

Binary schemas encode primitive types as bitwise-negated primitive indexes and user-defined schema types as non-negative indexes into the definition list.

Summary

Functions

decode(encoded_type, definitions)

@spec decode(integer(), [KiwiCodec.Schema.definition()]) :: String.t()

encode(field, definition_index)

@spec encode(KiwiCodec.Schema.Field.t(), %{required(String.t()) => non_neg_integer()}) ::
  integer()