enum TomlValue
pub enum TomlValue
Conforms to Equatable, Display, Debug, Index<string>, Codable.
A TOML value in one of its seven forms; a parsed document is a Table.
Variants
String(string)
Int(int)
Float(float)
Bool(bool)
Datetime(TomlDatetime)
Array(List<TomlValue>)
Table(TomlTable)
Methods
fn equals(o: TomlValue): bool
Returns whether both values have the same form and equal content; two tables are equal when they have the same keys with equal values, in any order.
fn show(): string
Returns a table as a document, any other value as its inline text.
fn showTo(out: StringBuilder): void
fn debug(): string
fn debugTo(out: StringBuilder): void
fn index(k: string): ?TomlValue
pub fn at(i: int): ?TomlValue
Returns the array element at i, or null where the value is no array or the index is
out of range.
pub fn path(p: string): ?TomlValue
Returns the value at a path such as "servers.alpha.ports[0]", or null where a step of
the path does not exist.
pub fn asString(): ?string
pub fn asInt(): ?int
pub fn asFloat(): ?float
Returns the number as a float, an Int widened; null for any other form.
pub fn asBool(): ?bool
pub fn asDatetime(): ?TomlDatetime
pub fn asArray(): ?List<TomlValue>
pub fn asTable(): ?TomlTable
fn encode<E :: [Encoder]>(&e: E): void throws EncodeError
static fn decode<D :: [Decoder]>(&d: D): TomlValue throws DecodeError
pub fn reader(): TomlReader
Returns a decoder over this tree, to pass on.
pub fn read<T :: [Decode]>(): T throws DecodeError
Decodes a value of type T from this tree.
Errors
Throws DecodeError where the tree does not fit T.