Skip to content
FutureBlitz

    Install

    Import std.data.toml

    Toml

    std.data.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)

    std/data/toml.fb, line 32

    • Public Static Method Read(text: String): Value Throws ParseError static method #

      The document text holds, as an Object. Throws a ParseError, with its line and column, of UNEXPECTED_END for text that 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.

    • @PanicsAtCaller Public Static Method Write(value: Value): String static method #

      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 when value isn'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.