Crate ini

source · []
Expand description

Ini parser for Rust

use ini::Ini;

let mut conf = Ini::new();
conf.with_section(Some("User"))
    .set("name", "Raspberry树莓")
    .set("value", "Pi");
conf.with_section(Some("Library"))
    .set("name", "Sun Yat-sen U")
    .set("location", "Guangzhou=world");
conf.write_to_file("conf.ini").unwrap();

let i = Ini::load_from_file("conf.ini").unwrap();
for (sec, prop) in i.iter() {
    println!("Section: {:?}", sec);
    for (k, v) in prop.iter() {
        println!("{}:{}", k, v);
    }
}

Structs

Ini struct

Parse error

Parsing configuration

Properties type (key-value pairs)

Iterator for traversing sections

Iterator for traversing sections

A view into a occupied entry in a Ini

A setter which could be used to set key-value pair in a specified section

A view into a vacant entry in a Ini

Writing configuration

Enums

Error while parsing an INI document

Policies for escaping logic

Newline style

A view into an Ini, which may either be vacant or occupied.

Type Definitions

Internal storage of property’s key

Internal storage of section’s key