# kiwi_codec v0.7.0 - Table of Contents > Pure Elixir codec for Kiwi schema binary messages ## Pages - [KiwiCodec](readme.md) - [Native decoders](native-decoders.md) - [Internals](internals.md) - [Changelog](changelog.md) ## Modules - [KiwiCodec.RustlerGenerator.Field](KiwiCodec.RustlerGenerator.Field.md): How a generated decoder reads or skips a schema field: once, repeated for an array, or as a whole byte array for `byte[]`. - [KiwiCodec.RustlerGenerator.Full](KiwiCodec.RustlerGenerator.Full.md): Generates full decoders: a struct or message decodes as its generated Elixir struct, an enum as its variant's atom; see `KiwiCodec.RustlerGenerator.Full.Helpers`. - [KiwiCodec.RustlerGenerator.Primitive](KiwiCodec.RustlerGenerator.Primitive.md): How generated decoders read and skip Kiwi's primitive values with the `Decoder`. - [KiwiCodec.RustlerGenerator.Skip.Messages](KiwiCodec.RustlerGenerator.Skip.Messages.md): `kiwi_skip_message_decoder!`, which defines a message's skip decoder from one row per field, sorted by id; see `KiwiCodec.RustlerGenerator.Skip.Helpers`. - [KiwiCodec.RustlerGenerator.Sparse.Messages](KiwiCodec.RustlerGenerator.Sparse.Messages.md): `kiwi_sparse_message_decoder!`, which defines a message's sparse decoder from one row per field, sorted by id; see `KiwiCodec.RustlerGenerator.Sparse.Helpers`. - [KiwiCodec.RustlerGenerator.Sparse.SkipMessages](KiwiCodec.RustlerGenerator.Sparse.SkipMessages.md): `kiwi_sparse_skip_message_decoder!`, which defines both a message's sparse decoder and its skip decoder from one row per field, sorted by id, when both are generated; see `KiwiCodec.RustlerGenerator.Sparse.Helpers` and `KiwiCodec.RustlerGenerator.Skip.Helpers`. - [KiwiCodec.RustlerGenerator.UnknownFieldRuntimeSchema](KiwiCodec.RustlerGenerator.UnknownFieldRuntimeSchema.md): `KiwiRuntimeSchema`, a schema read with the data, and the `kiwi_unknown_field` that skips a message field the compiled schema lacks with it; see `KiwiCodec.RustlerGenerator.UnknownFields`. - [KiwiCodec.RustlerGenerator.Values](KiwiCodec.RustlerGenerator.Values.md): What full and sparse decoders share: reading primitive values and enums as terms, and a field's value, once or repeated, with the function decoding its type. - Codec - [KiwiCodec](KiwiCodec.md): Encodes and decodes Kiwi messages as Elixir structs. - [KiwiCodec.Container](KiwiCodec.Container.md): Helpers for Kiwi chunk containers with an 8-byte magic and little-endian chunk lengths. - [KiwiCodec.DSL](KiwiCodec.DSL.md): Compile-time DSL behind `use KiwiCodec`. - [KiwiCodec.DecodeError](KiwiCodec.DecodeError.md): Raised when Kiwi wire data or binary schema data cannot be decoded. - [KiwiCodec.EncodeError](KiwiCodec.EncodeError.md): Raised when a value cannot be encoded as Kiwi wire data. - [KiwiCodec.TransformModule](KiwiCodec.TransformModule.md): Hook behaviour for custom Kiwi encode/decode normalization. - Schemas - [KiwiCodec.Metadata](KiwiCodec.Metadata.md): Compiled metadata attached to generated Kiwi modules. - [KiwiCodec.Metadata.Field](KiwiCodec.Metadata.Field.md): Compiled metadata for one field in a generated Kiwi module. - [KiwiCodec.PrimitiveType](KiwiCodec.PrimitiveType.md): Kiwi primitive type metadata. - [KiwiCodec.Schema](KiwiCodec.Schema.md): Parsed Kiwi schema. - [KiwiCodec.Schema.Binary](KiwiCodec.Schema.Binary.md): Encoder and decoder for Kiwi's compact binary schema format. - [KiwiCodec.Schema.Enum](KiwiCodec.Schema.Enum.md): Kiwi enum definition. - [KiwiCodec.Schema.EnumVariant](KiwiCodec.Schema.EnumVariant.md): Kiwi enum variant. - [KiwiCodec.Schema.Field](KiwiCodec.Schema.Field.md): Kiwi struct or message field. - [KiwiCodec.Schema.Message](KiwiCodec.Schema.Message.md): Kiwi message definition. - [KiwiCodec.Schema.Struct](KiwiCodec.Schema.Struct.md): Kiwi struct definition. - [KiwiCodec.SchemaInterpreter](KiwiCodec.SchemaInterpreter.md): Interpreter for parsed Kiwi schemas without generated modules. - [KiwiCodec.SchemaInterpreter.Prepared](KiwiCodec.SchemaInterpreter.Prepared.md): Indexed Kiwi schema for repeated runtime interpretation. - Wire encoding - [KiwiCodec.Wire](KiwiCodec.Wire.md): Kiwi primitive wire encoders and decoders. - [KiwiCodec.Wire.VarFloat](KiwiCodec.Wire.VarFloat.md): Kiwi variable-length 32-bit float wire encoding. - [KiwiCodec.Wire.Varint](KiwiCodec.Wire.Varint.md): Kiwi integer wire encoding. - Elixir generation - [KiwiCodec.FileGenerator](KiwiCodec.FileGenerator.md): Writes generated Elixir source files from `.kiwi` schema text or parsed schemas. - [KiwiCodec.ModuleCompiler](KiwiCodec.ModuleCompiler.md): Compiles `.kiwi` schema text or parsed schemas into Elixir modules in memory. - [KiwiCodec.ModuleGenerator](KiwiCodec.ModuleGenerator.md): Generates Elixir source modules from parsed Kiwi schemas. - Rustler generation - [KiwiCodec.RustlerGenerator](KiwiCodec.RustlerGenerator.md): Generates Rust that decodes Kiwi data for a schema inside a Rustler NIF. - [KiwiCodec.RustlerGenerator.Decoder](KiwiCodec.RustlerGenerator.Decoder.md): The `Decoder<'a>` generated decoders read Kiwi data with. - [KiwiCodec.RustlerGenerator.Records](KiwiCodec.RustlerGenerator.Records.md): Generates native Kiwi records: decoded values Rust code can read, change, and share without building Elixir terms, and encode later as the sparse maps generated decoders return. - [KiwiCodec.RustlerGenerator.UnknownFields](KiwiCodec.RustlerGenerator.UnknownFields.md): Selects how generated Rustler decoders handle message fields the compiled schema does not define. - Codec internals - [KiwiCodec.Decoder](KiwiCodec.Decoder.md): Decodes Kiwi wire binaries into generated Kiwi structs. - [KiwiCodec.Encoder](KiwiCodec.Encoder.md): Encodes generated Kiwi structs into Kiwi wire iodata. - [KiwiCodec.GeneratedModule.Metadata](KiwiCodec.GeneratedModule.Metadata.md): Builds compiled metadata for modules generated with `use KiwiCodec`. - [KiwiCodec.GeneratedModule.Shape](KiwiCodec.GeneratedModule.Shape.md): Emits enum, struct, and message shape code for modules generated with `use KiwiCodec`. - [KiwiCodec.GeneratedModule.TypeSpec](KiwiCodec.GeneratedModule.TypeSpec.md): Builds typespec AST for generated Kiwi modules. - [KiwiCodec.Inspect](KiwiCodec.Inspect.md): Shared `Inspect` implementation for generated Kiwi structs. - Schema internals - [KiwiCodec.Schema.Binary.TypeIndex](KiwiCodec.Schema.Binary.TypeIndex.md): Encodes and decodes type references in Kiwi's compact binary schema format. - [KiwiCodec.Schema.Parser](KiwiCodec.Schema.Parser.md): Parser for `.kiwi` schema text. - [KiwiCodec.Schema.Token](KiwiCodec.Schema.Token.md): Source token with line and column information for schema parse errors. - [KiwiCodec.Schema.Tokenizer](KiwiCodec.Schema.Tokenizer.md): Tokenizes `.kiwi` schema text with source positions. - [KiwiCodec.Schema.Validator](KiwiCodec.Schema.Validator.md): Validates parsed Kiwi schemas after grammar parsing. - Rustler generation internals - [KiwiCodec.RustlerGenerator.AtomCache](KiwiCodec.RustlerGenerator.AtomCache.md): Interns the atoms generated sparse decoders put in every map: the module name, the `__kiwi_module__` key, and each field name. - [KiwiCodec.RustlerGenerator.Entrypoint](KiwiCodec.RustlerGenerator.Entrypoint.md): Generates NIFs decoding a binary as one definition, which `kiwi_decode_binary` does with the definition's full decoder, rejecting trailing bytes. - [KiwiCodec.RustlerGenerator.Full.Helpers](KiwiCodec.RustlerGenerator.Full.Helpers.md): Full decoders: a struct or message decodes as its generated Elixir struct, every field set. `kiwi_struct_decoder!` and `kiwi_message_decoder!` define one; enums use `KiwiCodec.RustlerGenerator.Values`' `kiwi_enum_decoder!`. - [KiwiCodec.RustlerGenerator.Name](KiwiCodec.RustlerGenerator.Name.md): The Rust names generated decoders give schema definitions and the functions reading their values: `decode_node_change_from_decoder` decodes a `NodeChange` fully, `decode_sparse_node_change_from_decoder` to the fields present, and `skip_node_change_from_decoder` skips one. - [KiwiCodec.RustlerGenerator.Selection](KiwiCodec.RustlerGenerator.Selection.md): Selects schema definitions and their dependencies for Rustler generation. - [KiwiCodec.RustlerGenerator.Skip](KiwiCodec.RustlerGenerator.Skip.md): Generates skip decoders, which read past a value without building a term; see `KiwiCodec.RustlerGenerator.Skip.Helpers`. - [KiwiCodec.RustlerGenerator.Skip.Helpers](KiwiCodec.RustlerGenerator.Skip.Helpers.md): Skip decoders: they read past a value without building a term, for callers projecting a few fields out of a large message. - [KiwiCodec.RustlerGenerator.Sparse](KiwiCodec.RustlerGenerator.Sparse.md): Generates sparse decoders: maps of the fields present, with `__kiwi_module__` naming the generated Elixir module; see `KiwiCodec.RustlerGenerator.Sparse.Helpers`. - [KiwiCodec.RustlerGenerator.Sparse.Helpers](KiwiCodec.RustlerGenerator.Sparse.Helpers.md): Sparse decoders: a struct or message decodes as a map of the fields present, keyed by their atoms, with `__kiwi_module__` naming its generated Elixir module. - [KiwiCodec.RustlerGenerator.Splice](KiwiCodec.RustlerGenerator.Splice.md): The shared Rust generated decoders call: each feature's helper module, whole, with the `kiwi_unknown_field` the `:unknown_fields` mode chooses, and for full decoders the Rustler helpers caching their atoms and building their structs. ## Mix Tasks - [mix kiwi.gen](Mix.Tasks.Kiwi.Gen.md): Generates Elixir modules from a `.kiwi` schema.