Flatbuf.Codegen.Enum (flatbuf v0.1.0)

Copy Markdown View Source

Emits an Elixir module for a FlatBuffers enum declaration.

The module exposes value/1 (atom → integer) and from_value/1 (integer → atom-or-nil). Variants keep their source-spelled atoms (:Red, not :red) to avoid surprising casing conversions.

For (bit_flags) enums, value/1 accepts a list of variants and OR's their bit values; from_value/1 returns the list of variants present in the supplied integer.

Summary

Functions

generate(enum, opts \\ [])

@spec generate(
  Flatbuf.Schema.Enum.t(),
  keyword()
) :: {module(), String.t()}