@std/data/toml.ms#
Import each required symbol with import Name from "@std/data/toml.ms".
TomlOptions Type#
Limits for parse on input bytes, nesting depth and parsed values. A field set to
null adds no limit. The defaults, depth 10,000 and 1,000,000 values, guard against
deeply nested or very large documents. A negative limit returns EINVAL.
type TomlOptions {
max_bytes Int? = null
max_depth Int? = 10000
max_values Int? = 1000000
}TomlOptions.max_bytes#
Maximum UTF-8 input bytes before CRLF normalization; null adds no budget.
max_bytes Int? = nullTomlOptions.max_depth#
Maximum value depth, including scalar leaves and implicit tables, with the root at one.
max_depth Int? = 10000TomlOptions.max_values#
Maximum containers and leaves, excluding keys; checked during parsing and materialization.
max_values Int? = 1000000TomlValue Enum#
A TOML value. Date and time values retain their original TOML text.
enum TomlValue {
StringValue(value String)
IntValue(value Int)
FloatValue(value Float)
BoolValue(value Bool)
DateTimeValue(text String)
ArrayValue(values List[TomlValue])
TableValue(values Map[String, TomlValue])
}TomlValue.ArrayValue#
An ordered array; elements can have different TOML value kinds.
ArrayValue(values List[TomlValue])TomlValue.BoolValue#
A TOML true or false value; other capitalizations are invalid.
BoolValue(value Bool)TomlValue.DateTimeValue#
A validated local/offset date or time token, retained as text.
DateTimeValue(text String)TomlValue.FloatValue#
A parsed floating-point number, including TOML infinity and NaN spellings.
FloatValue(value Float)TomlValue.IntValue#
A parsed whole number; out-of-range input is rejected rather than truncated.
IntValue(value Int)TomlValue.StringValue#
Text decoded from TOML basic or literal string syntax.
StringValue(value String)TomlValue.TableValue#
An insertion-ordered table; parse returns this case even for an empty document.
TableValue(values Map[String, TomlValue])TomlValue.ArrayValue.values#
Element values in document order, with ordinary mutable list storage.
values List[TomlValue]TomlValue.BoolValue.value#
The decoded boolean from the lowercase TOML token.
value BoolTomlValue.DateTimeValue.text#
Original accepted TOML date/time spelling, without a timezone conversion.
text StringTomlValue.FloatValue.value#
Numeric value of the accepted floating token, preserving signed zero.
value FloatTomlValue.IntValue.value#
Exact signed integer value of the accepted TOML numeric token.
value IntTomlValue.StringValue.value#
Unicode contents after the applicable escapes and multiline rules.
value StringTomlValue.TableValue.values#
String-keyed entries produced by assignments, dotted keys and table headers.
values Map[String, TomlValue]parse Function#
Parses a TOML document into a TableValue, which is empty for an empty document.
Invalid TOML returns an Error with kind EBADMSG that reports the source line and
column. A limit in options that the document exceeds returns EOVERFLOW.
fn parse(text String, options TomlOptions = TomlOptions()) Result[TomlValue, Error] { ... }stringify Function#
Writes a table value as a TOML document. Tables and arrays of tables use headers;
other values are written inline. A value that is not a TableValue, or that holds
a malformed date or time, returns EINVAL. Output longer than max_bytes returns
EOVERFLOW.
fn stringify(value TomlValue, max_bytes Int? = null) Result[String, Error] { ... }