Croma.SubtypeOfMap (croma v0.11.1) View Source
Helper module to define map-based types.
The following members are generated by use Croma.SubtypeOfMap
:
@type t
@spec valid?(term) :: boolean
- If
key_module
and/orvalue_module
exportsnew/1
,@spec new(term) :: Croma.Result.t(t)
@spec new!(term) :: 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