Croma.SubtypeOfInt (croma v0.11.1) View Source

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

  • @type t
  • @spec valid?(term) :: boolean

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