xdr v0.1.1 XDR.Type.Int View Source

RFC 4506, Section 4.1 - Integer

Link to this section Summary

Types

t()

Integer between -2^31 to 2^31 - 1

Functions

Decodes a 4-byte binary into an integer

Encodes an integer into a 4-byte binary

Determines if a value is a valid 4-byte integer

Link to this section Types

Link to this type t() View Source
t() :: -2147483648..2147483647

Integer between -2^31 to 2^31 - 1

Link to this section Functions

Link to this function decode(xdr) View Source
decode(xdr :: xdr()) ::
  {:ok, {int :: t(), rest :: XDR.Type.Base.xdr()}} |
  {:error, :invalid}

Decodes a 4-byte binary into an integer

Link to this function encode(int) View Source
encode(int :: t()) ::
  {:ok, xdr :: xdr()} |
  {:error, :invalid | :out_of_bounds}

Encodes an integer into a 4-byte binary

Link to this function valid?(int) View Source
valid?(int :: t()) :: boolean()

Determines if a value is a valid 4-byte integer