toml

Subset TOML Parser

Functions

FunctionDescription
_toml_byte_atInternal byte reader.
_toml_eqInternal: compare bytes.
_toml_skip_wsInternal: skip whitespace.
_toml_skip_lineInternal: skip to end of line.
_toml_storeInternal: store bytes to data_buf, return offset where stored.
_toml_store_dottedInternal: store a dotted key (table.key) to data_buf.
_toml_addInternal: add entry.
_toml_parse_intInternal: parse integer from buf at off with given length.
_toml_trim_endInternal: trim trailing ws. Returns new end pos.
_toml_parse_tableInternal: parse table header. Returns pos after line.
_toml_store_keyInternal: store key (dotted if table is set). Returns stored key offset and s…
_toml_parse_quotedInternal: parse a quoted string value. Returns pos after closing quote.
_toml_parse_unquotedInternal: parse an unquoted value. Returns pos after line.
_toml_parse_kvInternal: parse key=value line. Returns pos after line.
toml_parseParse TOML data. Returns handle.
toml_countNumber of entries.
_toml_findInternal: find entry by key. Returns index or -1.
toml_get_strGet string value for key. Copies to out, returns length. -1 if not found.
toml_get_i64Get integer value for key. Returns 0 if not found.
toml_get_boolGet boolean value for key. Returns 0 or 1. Returns -1 if not found.

Details

_toml_byte_at

fn _toml_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_toml_eq

fn _toml_eq(a: &i8, aoff: i64, alen: i64, b: &i8, boff: i64, blen: i64) -> i64

Internal: compare bytes.

_toml_skip_ws

fn _toml_skip_ws(buf: &i8, pos: i64, len: i64) -> i64

Internal: skip whitespace.

_toml_skip_line

fn _toml_skip_line(buf: &i8, pos: i64, len: i64) -> i64

Internal: skip to end of line.

_toml_store

fn _toml_store(h: &i64, src: &i8, off: i64, slen: i64) -> i64

Internal: store bytes to data_buf, return offset where stored.

_toml_store_dotted

fn _toml_store_dotted(h: &i64, buf: &i8, toff: i64, tlen: i64, koff: i64, klen: i64) -> i64

Internal: store a dotted key (table.key) to data_buf.

_toml_add

fn _toml_add(h: &i64, key_off: i64, key_len: i64, val_off: i64, val_len: i64, vtype: i64) -> i64

Internal: add entry.

_toml_parse_int

fn _toml_parse_int(buf: &i8, off: i64, plen: i64) -> i64

Internal: parse integer from buf at off with given length.

_toml_trim_end

fn _toml_trim_end(buf: &i8, start: i64, end_pos: i64) -> i64

Internal: trim trailing ws. Returns new end pos.

_toml_parse_table

fn _toml_parse_table(h: &i64, buf: &i8, pos: i64, len: i64) -> i64

Internal: parse table header. Returns pos after line.

_toml_store_key

fn _toml_store_key(h: &i64, buf: &i8, key_start: i64, key_end: i64, key_len_out: &i64) -> i64

Internal: store key (dotted if table is set). Returns stored key offset and sets key_len_out[0].

_toml_parse_quoted

fn _toml_parse_quoted(h: &i64, buf: &i8, pos: i64, len: i64, key_start: i64, key_end: i64) -> i64

Internal: parse a quoted string value. Returns pos after closing quote.

_toml_parse_unquoted

fn _toml_parse_unquoted(h: &i64, buf: &i8, pos: i64, len: i64, key_start: i64, key_end: i64) -> i64

Internal: parse an unquoted value. Returns pos after line.

_toml_parse_kv

fn _toml_parse_kv(h: &i64, buf: &i8, pos: i64, len: i64) -> i64

Internal: parse key=value line. Returns pos after line.

toml_parse

fn toml_parse(buf: &i8, len: i64) -> &i64

Parse TOML data. Returns handle.

toml_count

fn toml_count(h: &i64) -> i64

Number of entries.

_toml_find

fn _toml_find(h: &i64, key: &i8, klen: i64) -> i64

Internal: find entry by key. Returns index or -1.

toml_get_str

fn toml_get_str(h: &i64, key: &i8, klen: i64, out: &i8) -> i64

Get string value for key. Copies to out, returns length. -1 if not found.

toml_get_i64

fn toml_get_i64(h: &i64, key: &i8, klen: i64) -> i64

Get integer value for key. Returns 0 if not found.

toml_get_bool

fn toml_get_bool(h: &i64, key: &i8, klen: i64) -> i64

Get boolean value for key. Returns 0 or 1. Returns -1 if not found.