alpm_parsers::custom_ini

Module de

source
Expand description

A custom INI parser and deserializer.

This module provides functionality for parsing and deserializing INI-style configuration files, where each line is expected to follow the format key=value.

It supports keys with single values as well as keys that appear multiple times, which are represented as sequences of values.

§Example

use alpm_parsers::custom_ini;
use serde::Deserialize;

#[derive(Debug, Deserialize)]
struct Data {
    num: u64,
    text: String,
    list: Vec<String>,
}

fn main() -> custom_ini::Result<()> {
    let content = "
        num = 42
        text = foo
        list = bar
        list = baz
        list = qux
    ";

    let data = custom_ini::from_str::<Data>(content)?;

    assert_eq!(data.num, 42);
    assert_eq!(data.text, "foo");
    assert_eq!(data.list, vec!["bar", "baz", "qux"]);

    Ok(())
}

Structs§

Enums§

Functions§

Type Aliases§