Want.Integer (want v1.14.0)
Manages conversions to and from integers.
Link to this section Summary
Link to this section Types
Link to this type
result()
Specs
Link to this section Functions
Link to this function
cast(value)
Cast a value to an integer.
Options
:max
- Maximum allowable integer value.:min
- Minimum allowable integer value.
Examples
iex> Want.Integer.cast("1")
iex> Want.Integer.cast(1.0)
iex> Want.Integer.cast(:'1')
iex> Want.Integer.cast({:a, :b}) {:error, "Failed to convert value {:a, :b} to integer."}
iex> Want.Integer.cast("10", max: 3)
iex> Want.Integer.cast(1.0, min: 3)
Link to this function
cast(value, opts)
Specs
Callback implementation for Want.Type.cast/2
.