veko doc
Self-Contained API Reference • Gradual Types • Capabilities • Wasm Sandbox

codec/toml

lib/codec/toml.vk

lib/codec/toml.vk Pure-Veko TOML v1.0 configuration parser and encoder. Supports [tables], [nested.tables], # comments, basic/literal strings, integers (with _ separators), floats, booleans, arrays, and inline tables { k = v }. Zero capabilities required.

signature
decode = fn [src str] map

Decodes a TOML v1.0 string into nested Veko maps, blocks, strings, integers, floats, and booleans.

Executable Example
veko
use [toml = codec/toml]
doc = toml/decode 'title = "Veko"\n[server]\nhost = "127.0.0.1"\nport = 8_080\ntls = true\ntags = ["pqc", "oro"]\n'
if doc.title != 'Veko' or doc.server.port != 8080 or doc.server.tls != true or (len doc.server.tags) != 2 [
  err 'toml decode'
] else [ .ok ]
signature
encode = fn [doc map] str

Encodes a Veko map (including nested sub-tables) into a clean TOML v1.0 string.