croma v0.10.2 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) :: booleanIf
key_moduleand/orvalue_moduleexportsnew/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