Elixir XDR v0.1.5 XDR.VariableArray View Source

This module manages the Variable-Length Array type based on the RFC4506 XDR Standard.

Link to this section Summary

Types

t()

XDR.VariableArray structure type specification.

Functions

Decode the Variable-Length Array in XDR format to a XDR.VariableArray structure.

Decode the Variable-Length Array in XDR format to a XDR.VariableArray structure. If the binaries are not valid, an exception is raised.

Encode a XDR.VariableArray structure into a XDR format.

Encode a XDR.VariableArray structure into a XDR format. If the variable_array is not valid, an exception is raised.

Create a new XDR.VariableArray structure with the elements, type and max_length passed.

Link to this section Types

Specs

t() :: %XDR.VariableArray{
  elements: list() | binary(),
  max_length: integer(),
  type: module()
}

XDR.VariableArray structure type specification.

Link to this section Functions

Specs

decode_xdr(bytes :: binary(), struct :: t()) ::
  {:ok, {list(), binary()}}
  | {:error,
     :not_number
     | :exceed_lower_bound
     | :exceed_upper_bound
     | :invalid_length
     | :invalid_binary
     | :not_binary}

Decode the Variable-Length Array in XDR format to a XDR.VariableArray structure.

Link to this function

decode_xdr!(bytes, struct)

View Source

Specs

decode_xdr!(bytes :: binary(), struct :: map()) :: {list(), binary()}

Decode the Variable-Length Array in XDR format to a XDR.VariableArray structure. If the binaries are not valid, an exception is raised.

Specs

encode_xdr(variable_array :: t()) ::
  {:ok, binary()}
  | {:error,
     :not_number
     | :exceed_lower_bound
     | :exceed_upper_bound
     | :not_list
     | :length_over_max}

Encode a XDR.VariableArray structure into a XDR format.

Link to this function

encode_xdr!(variable_array)

View Source

Specs

encode_xdr!(variable_array :: t()) :: binary()

Encode a XDR.VariableArray structure into a XDR format. If the variable_array is not valid, an exception is raised.

Link to this function

new(elements, type, max_length \\ 4294967295)

View Source

Specs

new(elements :: list() | binary(), type :: module(), max_length :: integer()) ::
  t()

Create a new XDR.VariableArray structure with the elements, type and max_length passed.