combine v0.9.6 Combine.Parsers.Binary
This module defines common raw binary parsers, i.e. bits, bytes, uint, etc.
To use them, just add import Combine.Parsers.Binary
to your module, or
reference them directly.
All of these parsers operate on, and return bitstrings as their results.
Summary
Functions
This parser parses N bits from the input
This parser parses N bytes from the input
This parser parses a n-bit floating point number from the input
This parser parses a signed, n-bit integer from the input with the given endianness
This parser parses an unsigned, n-bit integer from the input with the given endianness
Types
Functions
This parser parses N bits from the input.
Example
iex> import Elixir.Combine.Parsers.Binary
...> Combine.parse("Hi", bits(8))
["H"]
...> Combine.parse("Hi", bits(8) |> bits(8))
["H", "i"]
This parser parses N bytes from the input.
Example
iex> import Elixir.Combine.Parsers.Binary
...> Combine.parse("Hi", bytes(1))
["H"]
...> Combine.parse("Hi", bytes(1) |> bytes(1))
["H", "i"]
This parser parses a n-bit floating point number from the input.
Example
iex> import Elixir.Combine.Parsers.Binary
...> Combine.parse(<<2.50::float-size(32)>>, float(32))
[2.5]
This parser parses a signed, n-bit integer from the input with the given endianness.
Example
iex> import Elixir.Combine.Parsers.Binary
...> Combine.parse(<<-85::big-signed-size(16),"-90"::binary>>, int(16, :be))
[-85]
This parser parses an unsigned, n-bit integer from the input with the given endianness.
Example
iex> import Elixir.Combine.Parsers.Binary
...> Combine.parse(<<85::big-unsigned-size(16), "-90"::binary>>, uint(16, :be))
[85]