OmniBuf.Schema (omnibuf v0.1.0)

Copy Markdown View Source

Tier 3: Declarative Elixir struct DSL for OmniBuf v0.1.

Define numbered fields directly on an Elixir struct. Compile-time macros generate specialized iodata encoders, binary-matching decoders, merge decoders, and SchemaMeta builders with zero runtime reflection.

Example

defmodule MyApp.Location do
  use OmniBuf.Schema, name: "Location"

  field 1, :region, :string
  field 2, :datacenter, :string
  field 3, :city, :string
  field 4, :rack, :uint32
  field 5, :latitude, :float
  field 6, :longitude, :float
end

Summary

Functions

field(number, name, type, opts \\ [])

(macro)