DASL.DRISL.Decoder
(dasl v0.1.0)
View Source
DRISL decoder.
Validates and decodes a CBOR binary according to the DRISL profile. See the spec for the full set of constraints.
Summary
Functions
Decodes a DRISL-encoded binary into an Elixir term.
Functions
Decodes a DRISL-encoded binary into an Elixir term.
CBOR tag 42 values are decoded into %DASL.CID{} structs. Returns
{:ok, term, rest} on success, or {:error, reason} on failure.
Examples
iex> DASL.DRISL.Decoder.decode(<<0xa1, 0x61, 0x61, 0x01>>)
{:ok, %{"a" => 1}, ""}
iex> DASL.DRISL.Decoder.decode(<<0x83, 0x01, 0x02, 0x03>>)
{:ok, [1, 2, 3], ""}
iex> DASL.DRISL.Decoder.decode(<<0xf5>>)
{:ok, true, ""}
iex> DASL.DRISL.Decoder.decode(<<0xf6>>)
{:ok, nil, ""}