rad/toml

TOML is a markup language used by the gleam build tool and rad for configuration and recordkeeping.

Every Gleam project at a minimum has its own gleam.toml config, which both gleam and rad can read from and work with.

Types

A TOML table of dynamic data.

pub external type Toml

Functions

pub fn decode(from toml: Toml, get key_path: List(String), expect decoder: fn(
    Dynamic,
  ) -> Result(a, List(DecodeError))) -> Result(a, Snag)

Results in typed Gleam data decoded from the given Toml’s key_path on success, or a Snag on failure.

pub fn decode_every(from toml: Toml, get key_path: List(String), expect decoder: fn(
    Dynamic,
  ) -> Result(a, List(DecodeError))) -> Result(
  List(#(String, a)),
  Snag,
)

Results in a list of every key-value pair for which the value can be successfully decoded from the given Toml’s key_path using the given Decoder, or a Snag on failure.

pub fn from_dynamic(data: Dynamic) -> Result(
  Toml,
  List(DecodeError),
)

Results in a Toml decoded from the given dynamic data on success, or DecodeErrors on failure.

pub fn new() -> Toml

Returns a new, empty Toml.

pub fn parse_file(path: String) -> Result(Toml, Snag)

Results in a Toml parsed from the given file path on success, or a Snag on failure.

Search Document