Croma.SubtypeOfFloat (croma v0.11.1) View Source

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

  • @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 MyFloat do
  use Croma.SubtypeOfFloat, min: 0.0, max: 5.0, default: 0.0
end