BinCodex

Hex pmHex Docs

Provides functions to create composable and bidirectional serializers.

Installation

def deps do
  [
    {:bin_codex, "~> 0.1.0"}
  ]
end

Usage

The BinCodex module provides a number of predefined codecs and combinators that you can use to build new codes.

iex> first_codec = sequence([byte(), byte(), byte()])
...> <<0x10, 0xFF, 0xAB>> |> decode(first_codec)
{:ok, [16, 255, 171], <<>>}
...> [16, 255, 171] |> encode(first_codec)
{:ok, <<0x10, 0xFF, 0xAB>>}

Inspiration

This library draws inspiration from https://github.com/scodec/scodec