Lyricdev
GitHub

class TreeBuilder

pub class TreeBuilder :: [Encoder]

Conforms to Encoder.

An encoder that builds a TomlValue: a struct as a table, a map as a table of string keys, a sequence as an array, bytes as an array of integers, a unit variant as its name, a payload variant as a table of one key.

Methods

pub static fn new(): TreeBuilder
pub fn value(): TomlValue

Returns the value built once one was encoded; an empty table before.

pub mut fn encodeNull(): void throws EncodeError

Encodes a null: since TOML has no null, a null field is left out of its table.

Errors

Throws EncodeError for a null anywhere other than a table's field.

pub mut fn encodeBool(v: bool): void throws EncodeError
pub mut fn encodeInt(v: int): void throws EncodeError
pub mut fn encodeUint(v: uint): void throws EncodeError
pub mut fn encodeFloat(v: float): void throws EncodeError
pub mut fn encodeString(v: string): void throws EncodeError
pub mut fn encodeBytes(v: Slice<uint8>): void throws EncodeError
pub mut fn beginSeq(count: int): void throws EncodeError
pub mut fn endSeq(): void throws EncodeError
pub mut fn beginMap(count: int): void throws EncodeError
pub mut fn beginKey(): void throws EncodeError
pub mut fn endMap(): void throws EncodeError
pub mut fn beginStruct(name: string, count: int): void throws EncodeError
pub mut fn beginField(name: string): void throws EncodeError
pub mut fn endStruct(): void throws EncodeError
pub mut fn beginVariant(
    enumName: string,
    variant: string,
    index: int,
    hasPayload: bool
): void throws EncodeError
pub mut fn endVariant(): void throws EncodeError
pub fn path(): string