BinFormat.FieldType.BuiltIn
Standard Elixir binary match types for defformat.
This module implements all the types supported natively by Elixir in binary patterns and provides macros for adding them to a format’s structure in the defformat macro.
The arguments provided are directly translated into both the binary and struct patterns used in the generated functions. All of the macros in this module follow a common pattern. The binary match snippet
<< ... name :: type-option1-option2-size(16), ... >>
becomes
type :name, default, 16, [option1, option2]
inside defpacket (where default is the default value used in defstruct).
Size is supported on all types excepty utf8
, utf16
and utf32
. Passing
:undefined will cause the size to be ignored if options are needed but size
would be left blank when building the code by hand. A default is mandatory
for all types.
Summary
Macros
Add a Binary field to the format structure in defformat
Add a Bits field to the format structure in defformat
Add a Bitstring field to the format structure in defformat
Add a Bytes field to the format structure in defformat
Add a Float field to the format structure in defformat
Add an Integer field to the format structure in defformat
Add a UTF16 field to the format structure in defformat
Add a UTF32 field to the format structure in defformat
Add a UTF8 field to the format structure in defformat
Macros
Add a Binary field to the format structure in defformat.
Add a Bits field to the format structure in defformat.
Add a Bitstring field to the format structure in defformat.
Add a Bytes field to the format structure in defformat.
Add a Float field to the format structure in defformat.
Add an Integer field to the format structure in defformat.