grizzly v0.8.7 Grizzly.Command.Encoding View Source

Utility module to validate command arguments prior to command encoding

Link to this section Summary

Functions

Verifies that the (sub)arguments of a command, possibly after encoding, meet the given type specs

Link to this section Types

Link to this type

sizable() View Source
sizable() :: :bits | :bytes

Link to this type

spec() View Source
spec() ::
  :byte
  | :byte
  | :integer
  | :positive_integer
  | :binary
  | :bit
  | {sizable(), size()}
  | {[specs()], size()}

Link to this type

specs() View Source
specs() ::
  spec()
  | [specs()]
  | {:encode_with, atom()}
  | {:encode_with, atom(), atom()}
  | {:encode_in_context_with, atom(), atom()}
  | {:range, integer(), integer()}
  | %{required(atom()) => specs()}

Link to this section Functions

Link to this function

encode_and_validate_args(command, type_specs, sub_arguments_path \\ []) View Source
encode_and_validate_args(struct(), %{required(atom()) => specs()}, [atom()]) ::
  {:ok, struct()} | {:error, Grizzly.Command.EncodeError.t()}

Verifies that the (sub)arguments of a command, possibly after encoding, meet the given type specs