niffler_precompiled/toml

A deliberately small TOML reader for niffler.toml.

Supported: single-level tables, bare keys, basic/literal strings, arrays, booleans, and integers. Comments and multi-line arrays are supported. This is enough for niffler’s own configuration and keeps the runtime dependency surface at zero.

Types

pub type Document {
  Document(tables: List(Table))
}

Constructors

  • Document(tables: List(Table))
pub type Table {
  Table(name: String, entries: List(#(String, Value)))
}

Constructors

  • Table(name: String, entries: List(#(String, Value)))
pub type Value {
  TString(String)
  TInt(Int)
  TBool(Bool)
  TArray(List(Value))
}

Constructors

  • TString(String)
  • TInt(Int)
  • TBool(Bool)
  • TArray(List(Value))

Values

pub fn get_bool(
  entries: List(#(String, Value)),
  key: String,
) -> Result(Bool, String)
pub fn get_int(
  entries: List(#(String, Value)),
  key: String,
) -> Result(Int, String)
pub fn get_optional_string(
  entries: List(#(String, Value)),
  key: String,
) -> Result(option.Option(String), String)
pub fn get_optional_string_array(
  entries: List(#(String, Value)),
  key: String,
) -> Result(option.Option(List(String)), String)
pub fn get_string(
  entries: List(#(String, Value)),
  key: String,
) -> Result(String, String)
pub fn get_string_array(
  entries: List(#(String, Value)),
  key: String,
) -> Result(List(String), String)
pub fn keys(entries: List(#(String, Value))) -> List(String)
pub fn parse(input: String) -> Result(Document, String)
pub fn parse_value(raw: String) -> Result(Value, String)
pub fn table(
  document: Document,
  name: String,
) -> Result(List(#(String, Value)), String)
pub fn table_names(document: Document) -> List(String)
✨ Search Document