Module encoding/toml
encoding/toml
Basic TOML parser for configuration files.
Parses a subset of TOML into a TomlValue tree.
Supports: strings, integers, booleans, table sections, comments.
Example
{ toml_parse, TomlValue } :: import "std/encoding/toml";
// Or via the encoding index:
{ toml_parse, TomlValue } :: import "std/encoding";
Types
TomlValue
enum
TomlValue
TOML value type — the result of parsing a TOML document.
Variants
| Variant | Fields | Description |
|---|---|---|
Str | value: String | A TOML string value. |
Int | value: i64 | A TOML integer value. |
Bool | value: bool | A TOML boolean value. |
Table | keys: ArrayList(String), values: ArrayList(enum(Str(value: String), Int(value: i64), Bool(value: bool))) | A TOML table (ordered key-value map). |
impl(TomlValue, ...)
new_table : (TomlValue) fn() -> TomlValueCreate a new empty table.
Returns: TomlValue
get : (TomlValue) fn(self : TomlValue, key : String) -> Option(TomlValue)has_key : (TomlValue) fn(self : TomlValue, key : String) -> boolset : (TomlValue) fn(self : TomlValue, key : String, value : TomlValue) -> unittable_len : (TomlValue) fn(self : TomlValue) -> usizeReturn the number of keys in the table, or 0 if not a table.
Parameters
| Name | Type | Notes |
|---|---|---|
self | TomlValue |
Returns: usize
as_string : (TomlValue) fn(self : TomlValue) -> Option(String)as_int : (TomlValue) fn(self : TomlValue) -> Option(i64)Functions
toml_parse
function