Toml
TOML v1.0 parser (pure March, no FFI)
Supports: strings (basic, literal, multiline), integers, floats, booleans, arrays, inline tables, table headers [x], array-of-tables [[x]], dotted keys, quoted keys, comments.
Public API: Toml.parse(src) : Result(TomlValue, TomlError) Toml.parse_exn(src) : TomlValue (panics on error) Toml.to_string(v) : String Toml.get(v, key) : Option(TomlValue) Toml.get_in(v, keys) : Option(TomlValue) Toml.get_str(v, key) : Option(String) Toml.get_int(v, key) : Option(Int) Toml.get_float(v, key) : Option(Float) Toml.get_bool(v, key) : Option(Bool) Toml.get_table(v, key) : Option(TomlValue) Toml.get_array(v, key) : Option(List(TomlValue))
Types
Functions
Look up a top-level key in a TOML table value.
Toml.get(table, "port") -- Some(TInt(8080)) or NoneGet an array value by key, or None if absent or wrong type.
Get a boolean value by key, or None if absent or wrong type.
Get a float value by key, or None if absent or wrong type.
Look up a nested key path.
Toml.get_in(v, ["server", "host"])Get an integer value by key, or None if absent or wrong type.
Get a string value by key, or None if absent or wrong type.
Get a table value by key, or None if absent or wrong type.
Parse a TOML document string. Returns Ok(TomlValue) on success or Err(TomlError(message, line, col)) on failure.
Toml.parse("port = 8080") -- Ok(TTable([("port", TInt(8080))]))Parse TOML, panicking on error. Useful for compile-time literals.