View Source Vx.Float (Vx v0.4.0)
The Float type.
Summary
Types
@opaque t()
The float type.
Functions
Requires the float to have no decimal places.
Examples
iex> Vx.Float.integer() |> Vx.validate!(123.0)
:ok
iex> Vx.Float.integer() |> Vx.validate!(123.4)
** (Vx.Error) must have no decimal places
iex> Vx.Float.integer() |> Vx.validate!("foo")
** (Vx.Error) must be a float
@spec t() :: t()
Builds a new Float type.
Examples
iex> Vx.Float.t() |> Vx.validate!(1.0)
:ok
iex> Vx.Float.t() |> Vx.validate!(1)
** (Vx.Error) must be a float
iex> Vx.Float.t() |> Vx.validate!("foo")
** (Vx.Error) must be a float