Reference · reference
data module
use data parses and serializes INI files over the Value type. JSON, TOML and XML live in their own modules: json, toml and xml. Both functions return Result[…, string]. The parser accepts key=value lines and [section] headers, and rejects any other non-blank line with an error that names the line number.
ini_parse
rust
ini_parse
Parses INI text into a map of sections. Each section is a map of its keys. Keys that appear before the first section header are placed under the empty-string section, which is dropped when it is empty.
ini_serialize
rust
ini_serialize
Serializes a map of sections to INI text. The value must be a map whose entries are maps; anything else is an error.
rust
use data
use fs
let cfg = ini_parse?
let server = cfg.get // Option[Value], a map of the section's keys