F3. Format
(F3 v0.1.0)
Copy Markdown
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.
Summary
Types
Field name and width in bytes, from the start of the postscript.
Functions
Whether this build accepts a wire version.
Two-byte magic that terminates a file.
Wire major version this build accepts. The library version is a separate number.
Wire minor version this build accepts.
Postscript fields in file order. Widths sum to postscript_size/0.
Postscript length in bytes, including the magic.
Full upstream commit this build is compatible with.
Types
@type layout_field() :: {atom(), pos_integer()}
Field name and width in bytes, from the start of the postscript.
Functions
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
@spec magic() :: <<_::16>>
Two-byte magic that terminates a file.
Examples
iex> F3.Format.magic()
"F3"
@spec major_version() :: 0
Wire major version this build accepts. The library version is a separate number.
Examples
iex> F3.Format.major_version()
0
@spec minor_version() :: 1
Wire minor version this build accepts.
Examples
iex> F3.Format.minor_version()
1
@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
@spec postscript_size() :: 32
Postscript length in bytes, including the magic.
Examples
iex> F3.Format.postscript_size()
32
@spec upstream_sha() :: String.t()
Full upstream commit this build is compatible with.
Examples
iex> F3.Format.upstream_sha()
"bd92506447dc1333820cfe9a34ebbf497fe0219e"