About
The TOML package in the Mys programming language.
API
trait Value:
A value in a TOML document.
func table(self) -> {string: Value}:
As a table. Raises an error for non-table values.
func get(self, key: string) -> Value:
As an item from a table. Raises an error for non-table values and
if the key is missing.
func array(self) -> [Value]:
As an array. Raises an error for non-array values.
func at(self, index: i64) -> Value:
As an item in an array. Raises an error for non-array values.
func string(self) -> string:
As a string. Raises an error for non-string values.
func integer(self) -> i64:
As an integer. Raises an error for non-integer values.
func float(self) -> f64:
As a float. Raises an error for non-float values.
func bool(self) -> bool:
As a boolean. Raises an error for non-bool values.
class TomlError(Error):
message: string
class Table(Value):
A table.
items: {string: Value}
func __init__(self):
func table(self) -> {string: Value}:
func get(self, key: string) -> Value:
class Array(Value):
An array.
items: [Value]
func __init__(self):
func array(self) -> [Value]:
func at(self, index: i64) -> Value:
class String(Value):
A string.
value: string
func string(self) -> string:
class Integer(Value):
An integer.
value: i64
func integer(self) -> i64:
class Bool(Value):
A boolean.
value: bool
func bool(self) -> bool:
func decode(data: string) -> Table:
Decode given TOML string.