View Source Construct.Types.UUID (Construct.Types v0.2.2)

Checks that provided binary is UUID-like string:

defmodule Structure do
  use Construct

  structure do
    field :value, Construct.Types.UUID
  end
end

> Structure.make!(value: "fd4ddf80-a7d9-4af8-b46c-26fc4566d92c")
%Structure{value: "fd4ddf80-a7d9-4af8-b46c-26fc4566d92c"}

> Structure.make(value: "invalid")
{:error, %{value: :invalid}}

Link to this section Summary

Functions

Callback implementation for Construct.Type.cast/1.

Link to this section Functions