View Source Want.Atom (want v1.17.1)
Performs type conversions to atom values.
Summary
Types
Functions
Cast a value to an atom.
Options
:exists
- If true, only convert to an atom if a matching atom already exists.
Examples
iex> Want.Atom.cast("hello")
{:ok, :hello}
iex> Want.Atom.cast(1.0)
{:ok, :'1.0'}
iex> Want.Atom.cast({:a, :b})
{:error, "Failed to convert value {:a, :b} to atom."}
iex> Want.Atom.cast("10", exists: true)
{:error, "An atom matching the given value does not exist."}
Callback implementation for Want.Type.cast/2
.