# `F3.Format`

Pinned wire-format constants from upstream F3.

These values were read from `fff-format/src/lib.rs` and `format/File.fbs`
at commit `bd92506447dc1333820cfe9a34ebbf497fe0219e`. This module holds
the constants. `F3.Postscript` reads them from a file.

The postscript is 32 little-endian bytes at the end of the file. The two
magic bytes `F3` are last.

# `layout_field`

```elixir
@type layout_field() :: {atom(), pos_integer()}
```

Field name and width in bytes, from the start of the postscript.

# `compatible?`

```elixir
@spec compatible?(integer(), integer()) :: boolean()
```

Whether this build accepts a wire version.

Only major 0 and minor 1, the pair pinned from upstream, is accepted.
Any other pair is unsupported until a version adapter exists.

## Examples

    iex> F3.Format.compatible?(0, 1)
    true

    iex> F3.Format.compatible?(1, 0)
    false

    iex> F3.Format.compatible?(0, 2)
    false

# `magic`

```elixir
@spec magic() :: &lt;&lt;_::16&gt;&gt;
```

Two-byte magic that terminates a file.

## Examples

    iex> F3.Format.magic()
    "F3"

# `major_version`

```elixir
@spec major_version() :: 0
```

Wire major version this build accepts. The library version is a separate
number.

## Examples

    iex> F3.Format.major_version()
    0

# `minor_version`

```elixir
@spec minor_version() :: 1
```

Wire minor version this build accepts.

## Examples

    iex> F3.Format.minor_version()
    1

# `postscript_layout`

```elixir
@spec postscript_layout() :: [layout_field()]
```

Postscript fields in file order. Widths sum to `postscript_size/0`.

Integer fields are little-endian. `:magic` is the raw bytes `F3`.

## Examples

    iex> F3.Format.postscript_layout() |> Enum.map(&elem(&1, 1)) |> Enum.sum()
    32

# `postscript_size`

```elixir
@spec postscript_size() :: 32
```

Postscript length in bytes, including the magic.

## Examples

    iex> F3.Format.postscript_size()
    32

# `upstream_sha`

```elixir
@spec upstream_sha() :: String.t()
```

Full upstream commit this build is compatible with.

## Examples

    iex> F3.Format.upstream_sha()
    "bd92506447dc1333820cfe9a34ebbf497fe0219e"

---

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