croma v0.4.0 Croma.SubtypeOfInt

Helper module to define integer-based types. The following members are generated by use Croma.SubtypeOfInt:

  • @type t
  • @spec validate(term) :: Croma.Result.t(t)

Options:

  • :min - Minimum value of this type (inclusive).
  • :max - Maximum value of this type (inclusive).
  • :default - Default value for this type. Passing this option generates default/0.

Examples

defmodule MyInt do
  use Croma.SubtypeOfInt, min: 0, max: 10, default: 0
end