hush v0.3.1 Hush.Cast View Source
Utility functions to cast String
s to Elixir native types
Link to this section Summary
Functions
Cast a string to any type. Returns an {:error, :cast} tuple on failure
Cast a string to any type. An error is returned on failure.
Link to this section Types
Specs
type_atom() :: :string | :atom | :charlist | :float | :integer | :boolean | :module
Specs
Link to this section Functions
Specs
to(type_atom(), String.t()) :: {:ok, type_native()} | {:error, :cast, type_atom()}
Cast a string to any type. Returns an {:error, :cast} tuple on failure
Specs
to!(:string, String.t()) :: String.t()
to!(:atom, String.t()) :: atom()
to!(:charlist, String.t()) :: charlist()
to!(:float, String.t()) :: float()
to!(:integer, String.t()) :: integer()
to!(:boolean, String.t()) :: boolean()
to!(:module, String.t()) :: module()
Cast a string to any type. An error is returned on failure.