xdr v0.1.2 XDR.Type.Union View Source
RFC 4506, Section 4.15 - Discriminated Union
Link to this section Summary
Functions
Decodes an XDR binary into a discriminant or {discriminant, value} tuple
Encodes a discriminant or {discriminant, value} tuple into an XDR binary
Determines if the discriminant (and if provided, the optional val) can be encoded into a valid union
Link to this section Types
Link to this type
cases()
View Source
cases() :: [{discriminant(), val :: switch() | XDR.Type.Void | atom()}]
Link to this type
discriminant()
View Source
discriminant() :: XDR.Type.Int.t() | XDR.Type.Uint.t() | XDR.Type.Enum.t() | XDR.Type.Bool.t()
Link to this type
spec()
View Source
spec() :: [switch: switch(), cases: cases(), default: switch(), attributes: attributes()]
Link to this type
switch()
View Source
switch() :: XDR.Type.Int | XDR.Type.Uint | XDR.Type.Enum | XDR.Type.Bool | module()
Link to this section Functions
Link to this function
decode(arg, spec)
View Source
decode(xdr :: xdr(), spec :: spec()) :: {:ok, {discriminant :: t(), rest :: XDR.Type.Base.xdr()}} | {:error, reason :: :invalid}
Decodes an XDR binary into a discriminant or {discriminant, value} tuple
Encodes a discriminant or {discriminant, value} tuple into an XDR binary
Determines if the discriminant (and if provided, the optional val) can be encoded into a valid union