View Source Want.Type behaviour (want v1.17.1)

Behaviour for type casting modules.

Summary

Functions

Invoke the cast/2 function on the given custom type module.

Determine whether a module represents a custom type.

Types

@type opts() :: Keyword.t()
@type schema() :: map()

Callbacks

@callback cast(input :: any(), opts() | schema()) ::
  {:ok, result :: any()} | {:error, reason :: any()}

Functions

Link to this function

cast(module, input, opts)

View Source
@spec cast(module(), input :: any(), opts()) ::
  {:ok, result :: any()} | {:error, reason :: any()}

Invoke the cast/2 function on the given custom type module.

@spec is_custom_type?(module()) :: boolean()

Determine whether a module represents a custom type.