Crate tini [] [src]

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

use tini::Ini;

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

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

use tini::Ini;

let conf = Ini::new().section("floats")
                     .item("consts", "3.1416, 2.7183")
                     .section("integers")
                     .item("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
IniIterMut