[][src]Crate light_ini

Light Ini file parser.

light-ini implements an event-driven parser for the INI file format. The handler must implement IniHandler.

use light_ini::{IniHandler, IniParser, IniHandlerError};

struct Handler {}

impl IniHandler for Handler {
    type Error = IniHandlerError;

    fn section(&mut self, name: &str) -> Result<(), Self::Error> {
        println!("section {}", name);
        Ok(())
    }

    fn option(&mut self, key: &str, value: &str) -> Result<(), Self::Error> {
        println!("option {} is {}", key, value);
        Ok(())
    }

    fn comment(&mut self, comment: &str) -> Result<(), Self::Error> {
        println!("comment: {}", comment);
        Ok(())
    }
}

let mut handler = Handler{};
let mut parser = IniParser::new(&mut handler);
parser.parse_file("example.ini");

Structs

IniHandlerError

Convenient error type for handlers that don't need detailed errors.

IniParser

INI format parser.

Enums

IniError

Errors for INI format parsing

Traits

IniHandler

Interface for the INI format handler