want v1.1.1 Want.Integer
Manages conversions to and from integers.
Link to this section Summary
Link to this section Types
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)
Callback implementation for Want.Type.cast/2
.