marshal v0.9.0 Marshal.Decode.Helper

Helper functions for pulling apart Marshal binary

Summary

Functions

Retrieve fixnum from Marshal binary

Retrieve string binary representation from Marshal binary

Retrieve key-value pairs of variables from Marshal binary

Retrieve variable list from Marshal binary

Functions

decode_fixnum(arg)

Retrieve fixnum from Marshal binary.

Examples

iex> Marshal.Decode.Helper.decode_fixnum(<<0>>)
{0, <<>>}

iex> Marshal.Decode.Helper.decode_fixnum(<<3, 64, 226, 1>>)
{123456, <<>>}

iex> Marshal.Decode.Helper.decode_fixnum(<<253, 192, 29, 254>>)
{-123456, <<>>}
decode_string(bitstring)

Retrieve string binary representation from Marshal binary.

Examples

iex> Marshal.Decode.Helper.decode_string("  test")
{"test", ""}
get_tuples(bitstring, cache)

Retrieve key-value pairs of variables from Marshal binary.

Examples

iex> Marshal.Decode.Helper.get_tuples(":ET:@zi", {%{}, %{}})
{[E: true, "@z": 1], "", {%{0 => :E, 1 => :"@z"}, %{}}}
get_vars(bitstring, cache)

Retrieve variable list from Marshal binary.

Examples

iex> Marshal.Decode.Helper.get_vars("   :ET:@zi", {%{}, %{}})
{[:E, true, :"@z", 1], "", {%{0 => :E, 1 => :"@z"}, %{}}}