Fnord.Toml (fnord v0.9.29)

View Source

TOML parsing utilities.

This module is a wrapper around the third-party :toml package.

The rest of the codebase should depend on this wrapper rather than calling the external library directly. This keeps TOML usage consistent across features and makes it easy to swap parser implementations later.

All functions return {:ok, map} on success and {:error, reason} on failure.

Summary

Types

decode_error()

@type decode_error() ::
  {:toml_decode_error, String.t()}
  | {:toml_file_error, path :: String.t(), reason :: term()}

Functions

decode(toml)

@spec decode(binary()) :: {:ok, map()} | {:error, decode_error()}

decode_file(path)

@spec decode_file(String.t()) :: {:ok, map()} | {:error, decode_error()}