Skip to content

stdlib/tomlView source ↗

toml

78 items · generated by scribe fromstdlib/toml.fd· synced 2026-11-15

stdlib/toml78 items

Contents

TomlValue

A typed TOML value of the flat form. kind is one of “str” | “int” | “float” | “bool” | “array” | “invalid”, or for a date or time the toml_load kind (“datetime”, “date-local”, …). sval holds the decoded scalar; items the element values of an array ("" for an element that is itself an array or table).

pub struct TomlValue {

Fields:

NameType
kindstr
svalstr
itemsVec<str>

Defined at line 76


TomlEntry

One entry: dotted full path → value.

pub struct TomlEntry {

Fields:

NameType
pathstr
valueTomlValue

Defined at line 83


TomlDoc

A parsed document (see the module header). ok false: error says why and where. first/next/last link each node’s children (first child, next sibling, last child; -1 for none); the last four fields are the parser’s own state.

pub struct TomlDoc {

Fields:

NameType
okbool
errorstr
kindVec<str>
svalVec<str>
parentVec<i64>
keyVec<str>
flagsVec<i64>
sectVec<i64>
firstVec<i64>
nextVec<i64>
lastVec<i64>
srcstr
lenientbool
curi64
sectioni64

Defined at line 100


toml_load

Parse TOML text strictly (see the module header).

pub fn toml_load(text: str) -> TomlDoc {

Parameters:

  • text: str

Returns: TomlDoc

Defined at line 1328


toml_node_kind

The kind of node (“missing” for -1).

pub fn toml_node_kind(doc: TomlDoc, node: i64) -> str {

Parameters:

  • doc: TomlDoc
  • node: i64

Returns: str

Defined at line 1333


toml_node_value

The value of a scalar node as text ("" for tables, arrays, -1).

pub fn toml_node_value(doc: TomlDoc, node: i64) -> str {

Parameters:

  • doc: TomlDoc
  • node: i64

Returns: str

Defined at line 1341


toml_node_items

Child nodes of a table or array, in document order.

pub fn toml_node_items(doc: TomlDoc, node: i64) -> Vec<i64> {

Parameters:

  • doc: TomlDoc
  • node: i64

Returns: Vec<i64>

Defined at line 1349


toml_node_len

Number of elements of an array or keys of a table.

pub fn toml_node_len(doc: TomlDoc, node: i64) -> i64 {

Parameters:

  • doc: TomlDoc
  • node: i64

Returns: i64

Defined at line 1365


toml_node_keys

Keys of a table, in document order.

pub fn toml_node_keys(doc: TomlDoc, node: i64) -> Vec<str> {

Parameters:

  • doc: TomlDoc
  • node: i64

Returns: Vec<str>

Defined at line 1370


toml_node_child

The child of table node with key k, or -1.

pub fn toml_node_child(doc: TomlDoc, node: i64, k: str) -> i64 {

Parameters:

  • doc: TomlDoc
  • node: i64
  • k: str

Returns: i64

Defined at line 1382


toml_node_at

Element index of array node, or -1.

pub fn toml_node_at(doc: TomlDoc, node: i64, index: i64) -> i64 {

Parameters:

  • doc: TomlDoc
  • node: i64
  • index: i64

Returns: i64

Defined at line 1397


toml_lookup

The node at a dotted path from the root (“a.b.2.c”: a number indexes an array); -1 when absent. Keys holding ’.’ need toml_node_child.

pub fn toml_lookup(doc: TomlDoc, path: str) -> i64 {

Parameters:

  • doc: TomlDoc
  • path: str

Returns: i64

Defined at line 1415


toml_node_json

node in the JSON form of the toml-test suite: tables as objects (keys sorted bytewise), arrays as arrays, scalars as {“type”:“integer”,“value”:“1”}.

pub fn toml_node_json(doc: TomlDoc, node: i64) -> str {

Parameters:

  • doc: TomlDoc
  • node: i64

Returns: str

Defined at line 1553


toml_to_json

The whole document in the toml-test JSON form; "" when it failed.

pub fn toml_to_json(doc: TomlDoc) -> str {

Parameters:

  • doc: TomlDoc

Returns: str

Defined at line 1563


toml_parse

Parse TOML text into Vec(document order), leniently: see the module header. Tables become path prefixes; array elements are listed in their array’s items.

pub fn toml_parse(text: str) -> Vec<TomlEntry> {

Parameters:

  • text: str

Returns: Vec<TomlEntry>

Defined at line 1585


toml_get

The TomlValue at dotted path; kind “invalid” when absent.

pub fn toml_get(doc: Vec<TomlEntry>, path: str) -> TomlValue {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str

Returns: TomlValue

Defined at line 1631


toml_has

True if path exists.

pub fn toml_has(doc: Vec<TomlEntry>, path: str) -> bool {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str

Returns: bool

Defined at line 1644


toml_kind

Kind string for path (“invalid” if missing).

pub fn toml_kind(doc: Vec<TomlEntry>, path: str) -> str {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str

Returns: str

Defined at line 1649


toml_get_str

String value at path ("" when absent).

pub fn toml_get_str(doc: Vec<TomlEntry>, path: str) -> str {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str

Returns: str

Defined at line 1654


toml_get_int

Int value at path, default when absent or not numeric.

pub fn toml_get_int(doc: Vec<TomlEntry>, path: str, default: i64) -> i64 {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str
  • default: i64

Returns: i64

Defined at line 1659


toml_get_float

Float value at path, default when absent or not numeric.

pub fn toml_get_float(doc: Vec<TomlEntry>, path: str, default: f64) -> f64 {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str
  • default: f64

Returns: f64

Defined at line 1671


toml_get_bool

Bool value at path, default when absent or not a bool.

pub fn toml_get_bool(doc: Vec<TomlEntry>, path: str, default: bool) -> bool {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str
  • default: bool

Returns: bool

Defined at line 1680


toml_keys

All dotted key paths in document order.

pub fn toml_keys(doc: Vec<TomlEntry>) -> Vec<str> {

Parameters:

  • doc: Vec<TomlEntry>

Returns: Vec<str>

Defined at line 1689


toml_table_keys

Immediate child keys of table path ("" for the root table). e.g. with entries a.b and a.c.d, toml_table_keys(doc,“a”) → [“b”,“c”].

pub fn toml_table_keys(doc: Vec<TomlEntry>, path: str) -> Vec<str> {

Parameters:

  • doc: Vec<TomlEntry>
  • path: str

Returns: Vec<str>

Defined at line 1701


Generated by scribe, the Fides documentation generator