[][src]Function configster::parse_file

pub fn parse_file(
    filename: &str,
    attr_delimit_char: char
) -> Result<Vec<OptionProperties>>

Parses a configuration file. The second parameter sets the delimiter for the attribute list of the primary value. The return value is an OptionProperties type vector wrapped in an io::Result type. Details about the configuration file format are in the project's README.md.

Examples

Accessing the Parsed Data:

use std::io;

fn main() -> Result<(), io::Error> {

    let config_vec = configster::parse_file("./config_test.conf", ',')?;

    for i in &config_vec {
        println!("Option:'{}' | value '{}'", i.option, i.value.primary);

        for j in &i.value.attributes {
            println!("attr:'{}`", j);
        }
        println!();
    }
    Ok(())
}