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)
Summary
Functions
Encodes a value to TOML value format (inline).
Types
@type t() :: term()
All the types that implement this protocol.