std/toml
TOML 1.0 and every later 1.x as a format, written in TorbScript: Toml reads and writes any Encode/Decode type,
and TomlValue is the tree of a document, for one whose shape is not known ahead of time.
const toml = Toml()
const config = toml.decode<Config>(text)?
print(toml.encode(config)?)
A document is a table. A value is written as TOML only when it is a record or a map, a field that holds None is
left out, and the same field absent from a document reads as None or as the field's default. TOML has no null, so
None inside an array is an error of Toml.encode.
The reader takes every released 1.x. What 1.1 adds - inline tables over several lines, a time without seconds,
the escapes \e and \xHH - is read in every document, and TomlVersion only chooses what the writer may use.
Dates and times keep their nanoseconds and their offset: TomlOffsetDateTime, TomlLocalDateTime, TomlDate and
TomlTime are the types to have a field of, and a String field reads the text of a date or a time.
The reader passes the public toml-test suite for TOML 1.0 and 1.1.
Modules
std/toml/encoder[TomlEncoder]: anEncoderthat builds the TOML tree of a value, which the writer then writes.std/toml/errorTomlError: what went wrong reading or writing TOML - text that is not TOML, a document that does not fit the type it is decoded into, or a value that TOML cannot say.std/toml/toml[Toml], the format: a value with the options of TOML, which reads and writes typed values throughEncodeandDecode, and reads documents into the tree of [TomlValue]s and writes that tree back.std/toml/valueThe tree of a TOML document, [TomlValue], and the four date and time values TOML has: a date, a time, a date and time without an offset and a date and time with one.std/toml/writerThe TOML writer: a [TomlValue] tree to the text of a document.
Everything
- type
TomlTOML, with its options. - type
TomlDateA calendar date:1979-05-27. - extend
TomlDate with Encode, DecodeA date, a time and a date and time are written as their text and announced as a record of the type that holds nothing but that text - a wrapper - so thatTomlcan write them as TOML's own date and time values, and every other format writes the text. - type
TomlEncoderAnEncoderthat builds a [TomlValue]. - type
TomlEntryOne key of a table and its value. - type
TomlErrorWhat went wrong turning TOML text into a tree or a value, or a value into TOML text. - type
TomlLocalDateTimeA date and a time without an offset:1979-05-27T07:32:00. - extend
TomlLocalDateTime with Encode, DecodeA date and time without an offset is written as its text, in the same wrapper as [TomlDate]. - type
TomlOffsetDateTimeA date and a time with an offset from UTC:1979-05-27T07:32:00Zor1979-05-27T00:32:00-07:00. - extend
TomlOffsetDateTime with Encode, DecodeA date and time with an offset is written as its text, in the same wrapper as [TomlDate]. - type
TomlTimeA time of day without a date or an offset:07:32:00or00:32:00.999999. - extend
TomlTime with Encode, DecodeA time is written as its text, in the same wrapper as [TomlDate], so thatTomlwrites it as a TOML local time. - type
TomlValueOne value of a TOML document, as a tree. - type
TomlVersionThe version of TOML a writer keeps to.