Crate tini

Source
Expand description

tini is a tiny ini-file parsing library

This small library provides basic functions to operate with ini-files.

Features:

§Examples

§Read from buffer and get string values

let conf = Ini::from_string(["[search]",
                             "g = google.com",
                             "dd = duckduckgo.com"].join("\n")).unwrap();

let g: String = conf.get("search", "g").unwrap();
let dd: String = conf.get("search", "dd").unwrap();

assert_eq!(g, "google.com");
assert_eq!(dd, "duckduckgo.com");

§Construct in program and get vectors

let conf = Ini::new().section("floats")
                     .item_vec("consts", &[3.1416, 2.7183])
                     .section("integers")
                     .item_vec("lost", &[4, 8, 15, 16, 23, 42]);

let consts: Vec<f64> = conf.get_vec("floats", "consts").unwrap();
let lost: Vec<i32> = conf.get_vec("integers", "lost").unwrap();

assert_eq!(consts, [3.1416, 2.7183]);
assert_eq!(lost, [4, 8, 15, 16, 23, 42]);

Structs§

Ini
Structure for INI-file data
IniIter
An iterator over the sections of an ini document
IniIterMut
A mutable iterator over the sections of an ini document
Section
SectionIter
SectionIterMut

Enums§

Error
Options for possible errors that may arise
ParseError
Enum for storing one of the possible errors code. The associated value represents the row index where the error occurred.