# `TomlElixir.Encoder`
[🔗](https://github.com/nikolauska/toml_elixir/blob/v3.1.0/lib/toml_elixir/encoder.ex#L1)

Protocol for encoding Elixir terms to TOML.

You can derive this protocol for structs:

    @derive TomlElixir.Encoder
    defstruct [:name, :age]

    @derive {TomlElixir.Encoder, only: [:name]}
    defstruct [:name, :age, :password]

    @derive {TomlElixir.Encoder, except: [:password]}
    defstruct [:name, :age, :password]

If you don't own the struct, you can derive externally:

    Protocol.derive(TomlElixir.Encoder, NameOfTheStruct, only: [:field])
    Protocol.derive(TomlElixir.Encoder, NameOfTheStruct, except: [:field])
    Protocol.derive(TomlElixir.Encoder, NameOfTheStruct)

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `encode`

Encodes a value to TOML value format (inline).

---

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