Import std.data.toml
Toml
struct
Public Struct Toml
What reads and writes TOML documents, in its Static Methods.
Examples
Local config = Try Toml.Read(r"""
title = "demo"
[window]
width = 800
fullscreen = false
""")
Expect(config.Path("title")?.AsString() == "demo")
Expect(config.Path("window.width")?.AsInt() == 800)
Expect(config.Path("window.fullscreen")?.AsBool() == False)
Expect((Try Toml.Read(Toml.Write(config))) == config)-
The document
textholds, as an Object. Throws a ParseError, with its line and column, of UNEXPECTED_END fortextthat ends inside a string, an array, or an inline table, of OUT_OF_RANGE for an integer an Int64 doesn't hold, and of SYNTAX for the rest that isn't TOML 1.0, and for arrays and inline tables nested more than 256 deep. -
value, an Object, as a TOML document: each table's keys and values, then its tables, each under its header, an Array of Objects as an array of tables, and an Object in an Array as an inline table. TOML has no null, so an Object's Null is left out. Panics whenvalueisn't an Object, an Array holds a Null, it holds bytes or an integer past an Int64, or its arrays and inline tables nest more than 256 deep.
Report an issue with this page or with FutureBlitz on GitHub.