croma v0.8.0 Croma.SubtypeOfMap View Source
Helper module to define map-based types.
The following members are generated by use Croma.SubtypeOfMap
:
@type t
@spec valid?(term) :: boolean
@spec new(term) :: Croma.Result.t(t)
Options:
:key_module
- A type module for keys.:value_module
- A type module for values.:min_size
- Minimum size of valid values of this type (inclusive).:max_size
- Maximum size of valid values of this type (inclusive).:default
- Default value for this type. Passing this option generatesdefault/0
.
Examples
defmodule MyMap do
use Croma.SubtypeOfMap, key_module: MyString, value_module: MyInt, default: %{}
end