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.
The record runtime is schema-independent. The schema only supplies a definition table, read by the decoder and encoder, and constants naming each definition, field, and enum value for code that works with records:
kiwi_record_definitions::NODE_CHANGE
kiwi_records::NodeChange::FILL_PAINTS
kiwi_records::NodePhase::REMOVEDRustQ code that works with records names this module through alias, and RustQ imports the
runtime's functions, methods, and types from it, and the constants' modules:
alias KiwiCodec.RustlerGenerator.Records
@spec fill_paints(R.ref(Records.kiwi_record())) :: R.bool()
defrust fill_paints(record), do: record.has(Records.NodeChange.FILL_PAINTS)Records.Definitions.NODE_CHANGE names a definition, so a schema definition named
Definitions is reached only through its Rust path.
Decoding uses the Decoder methods KiwiCodec.RustlerGenerator.Decoder lists for records.
Unknown message fields go through kiwi_unknown_field; see
KiwiCodec.RustlerGenerator.UnknownFields.
Summary
Types
The Rust type KiwiRecord the module provides.
The Rust type KiwiRecordDefinition the module provides.
The Rust type KiwiRecordField the module provides.
The Rust type KiwiRecordVariant the module provides.
The Rust type KiwiValue the module provides.
Functions
Whether the module's Rust file appeared or went since the module compiled.
The RustQ AST of each defrust definition.
Callable metadata for the module's definitions.
The Rust items the module generates, in order.
The module's defrustmacro definitions.
The macro_rules! items defrustmacro emits.
The Rust modules the module's defrustmods map its aliases, or itself ([]), to.
The Rust source the module generates.
The RustQ AST of each declared Rust type.
The Rust items the module's types generate.
The Rust types the module's @types declare.
Returns the record runtime, and the kiwi_records! call declaring definitions' table and
constants, one row per definition.
Types
@type kiwi_record() :: term()
The Rust type KiwiRecord the module provides.
@type kiwi_record_definition() :: term()
The Rust type KiwiRecordDefinition the module provides.
@type kiwi_record_field() :: term()
The Rust type KiwiRecordField the module provides.
@type kiwi_record_variant() :: term()
The Rust type KiwiRecordVariant the module provides.
@type kiwi_value() :: term()
The Rust type KiwiValue the module provides.
Functions
Whether the module's Rust file appeared or went since the module compiled.
The RustQ AST of each defrust definition.
Callable metadata for the module's definitions.
The Rust items the module generates, in order.
The module's defrustmacro definitions.
The macro_rules! items defrustmacro emits.
The Rust modules the module's defrustmods map its aliases, or itself ([]), to.
The Rust source the module generates.
The RustQ AST of each declared Rust type.
The Rust items the module's types generate.
The Rust types the module's @types declare.
@spec fragments([KiwiCodec.Schema.definition()], String.t()) :: [term()]
Returns the record runtime, and the kiwi_records! call declaring definitions' table and
constants, one row per definition.