# `KiwiCodec.RustlerGenerator.Values`
[🔗](https://github.com/open-pencil/kiwi_codec/blob/v0.7.0/codegen/kiwi_codec/rustler_generator/values.ex#L2)

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.

`kiwi_enum_decoder!` defines an enum's decoder, which decodes a known value as its
variant's atom and an unknown one as the number.

# `kiwi_decode_fn`

```elixir
@type kiwi_decode_fn() ::
  RustQ.Type.raw(
    :&quot;for&lt;'a&gt; fn(Env&lt;'a&gt;, &amp;mut Decoder&lt;'_&gt;) -&gt; NifResult&lt;Term&lt;'a&gt;&gt;&quot;
  )
```

The Rust `KiwiDecodeFn`: decodes one value of a type as a term.

# `kiwi_enum_variant`

```elixir
@type kiwi_enum_variant() :: %{
  value: RustQ.Type.u32(),
  name: RustQ.Type.raw(:&quot;&amp;'static str&quot;)
}
```

The Rust `KiwiEnumVariant`: an enum value and the atom it decodes as.

# `__mix_recompile__?`

Whether the module's Rust file appeared or went since the module compiled.

# `__rustq_asts__`

The RustQ AST of each `defrust` definition.

# `__rustq_callables__`

Callable metadata for the module's definitions.

# `__rustq_items__`

The Rust items the module generates, in order.

# `__rustq_macro_definitions__`

The module's `defrustmacro` definitions.

# `__rustq_macro_items__`

The `macro_rules!` items `defrustmacro` emits.

# `__rustq_rust_modules__`

The Rust modules the module's `defrustmod`s map its aliases, or itself (`[]`), to.

# `__rustq_source__`

The Rust source the module generates.

# `__rustq_type_asts__`

The RustQ AST of each declared Rust type.

# `__rustq_type_items__`

The Rust items the module's types generate.

# `__rustq_types__`

The Rust types the module's `@type`s declare.

# `kiwi_bool_value`

```elixir
@spec kiwi_bool_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_byte_value`

```elixir
@spec kiwi_byte_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_bytes_value`

```elixir
@spec kiwi_bytes_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_enum_value`

```elixir
@spec kiwi_enum_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_))),
  RustQ.Type.slice(kiwi_enum_variant())
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_field_value`

```elixir
@spec kiwi_field_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_))),
  RustQ.Type.bool(),
  kiwi_decode_fn()
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_float_value`

```elixir
@spec kiwi_float_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_int64_value`

```elixir
@spec kiwi_int64_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_int_value`

```elixir
@spec kiwi_int_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_string_value`

```elixir
@spec kiwi_string_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_uint64_value`

```elixir
@spec kiwi_uint64_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

# `kiwi_uint_value`

```elixir
@spec kiwi_uint_value(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.mut_ref(RustQ.Type.path(:Decoder, RustQ.Type.lifetime(:_)))
) :: RustQ.Type.nif_result(term())
```

A Rust function `defrust` generates. It runs only as Rust; calling it from Elixir
raises.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
