Lyricdev
GitHub

class TomlReader

pub class TomlReader :: [Decoder]

Conforms to Decoder.

A decoder over a TomlValue tree: a struct from a table by its keys, a sequence from an array, a map from a table (its keys as strings, or as the numbers they spell), a variant from a string or a table of one key, bytes from an array of integers, a string from a string or a date-time's text. A read that mismatches leaves the value where it was.

Methods

pub mut fn isNull(): bool throws DecodeError

Returns false: TOML has no null.

pub mut fn decodeNull(): void throws DecodeError
pub mut fn decodeBool(): bool throws DecodeError
pub mut fn decodeInt(): int throws DecodeError
pub mut fn decodeUint(): uint throws DecodeError
pub mut fn decodeFloat(): float throws DecodeError
pub mut fn decodeString(): string throws DecodeError

Decodes a string, or a date-time's text, so an Instant reads from an offset date-time.

Errors

Throws DecodeError where the value is neither a string nor a date-time.

pub mut fn decodeBytes(): uint8[] throws DecodeError
pub mut fn beginSeq(): ?int throws DecodeError
pub fn seqHasNext(): bool throws DecodeError
pub mut fn endSeq(): void throws DecodeError
pub mut fn beginMap(): ?int throws DecodeError
pub fn mapHasNext(): bool throws DecodeError
pub mut fn endMap(): void throws DecodeError
pub mut fn beginStruct(name: string, fields: string[]): void throws DecodeError
pub mut fn structField(name: string): bool throws DecodeError
pub mut fn endStruct(denyUnknown: bool): void throws DecodeError
pub mut fn beginVariant(enumName: string, variants: string[]): int throws DecodeError
pub fn variantHasPayload(): bool throws DecodeError
pub mut fn endVariant(): void throws DecodeError
pub fn path(): string

Returns where the decoder stands, such as Config.servers[0].Server.port: a struct's name and the key being read with . between, an array's index without, {} for a map, a variant's name.