Exgencode.Pdu.decode

You're seeing just the function decode, go back to Exgencode.Pdu module for more information.
Link to this function

decode(pdu, binary, version \\ nil)

Specs

decode(Exgencode.pdu(), binary(), nil | Version.version()) ::
  {Exgencode.pdu(), binary()}

Decode a binary into the specified Elixir structure.

Returns the given structure with fields filled out and the remainder binary. The remainder should be an empty binary and leftovers usually indicate a mangled binary.

Examples:

iex> Exgencode.Pdu.decode(%TestPdu.PzTestMsg{}, << 1 :: size(12), 100 :: size(24), 15 :: size(8), 10 :: size(28)>>)
{%TestPdu.PzTestMsg{otherTestField: 100}, <<>>}

Version number can be optionally added to control how the decoding function reads the given binary. If the provided version does not match the requirement specified in the field definition the given field will be ignored.

Examples:

iex> Exgencode.Pdu.decode(%TestPdu.VersionedMsg{}, << 10 :: size(16) >>, "1.0.0")
{%TestPdu.VersionedMsg{oldField: 10}, <<>>}

iex> Exgencode.Pdu.decode(%TestPdu.VersionedMsg{}, << 10 :: size(16), 111 :: size(8) >>, "2.0.0")
{%TestPdu.VersionedMsg{oldField: 10, newerField: 111}, <<>>}