# `Skogsra.Type`
[🔗](https://github.com/gmtprime/skogsra/blob/v2.5.2/lib/skogsra/type.ex#L1)

This module defines the functions and behaviours for casting `Skogsra` types.

# `cast`

```elixir
@callback cast(term()) :: {:ok, term()} | :error
```

Callback for casting a value.

# `__using__`
*macro* 

Uses `Skogsra.Type` for implementing the behaviour e.g. a naive implementation
for casting `"1, 2, 3, 4"` to `["1", "2", "3", "4"]` would be:

```
defmodule MyList do
  use Skogsra.Type

  def cast(value) when is_binary(value) do
    list =
      value
      |> String.split(~r/,/)
      |> Enum.map(&String.trim/1)
    {:ok, list}
  end

  def cast(_) do
    :error
  end
end
```

# `cast`

```elixir
@spec cast(Skogsra.Env.t(), term()) :: {:ok, term()} | :error
```

Casts an environment variable.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
