| Crates.io | inihx |
| lib.rs | inihx |
| version | 0.1.0 |
| created_at | 2025-07-24 16:51:19.980576+00 |
| updated_at | 2025-07-24 16:51:19.980576+00 |
| description | INI parser and Serde (de)serializer in pure Rust. Inspired by INIH C INI parser. |
| homepage | |
| repository | https://github.com/YOUR_USERNAME/inihx |
| max_upload_size | |
| id | 1766298 |
| size | 25,352 |
A simple, readable INI file parser and serializer for Rust, inspired by the inih C library.
HashMap or strongly typed structs)[dependencies]
inihx = "0.1"
use inihx::parse_ini_file;
fn main() -> Result<(), std::io::Error> {
let config = parse_ini_file("config.ini")?;
println!("{}", config["server"]["port"]);
Ok(())
}
use inihx::de::from_ini_file;
use inihx::parse_ini::IniParserConfig;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct Config {
server: ServerSection,
database: DatabaseSection,
}
#[derive(Debug, Deserialize)]
struct ServerSection {
port: u16,
}
#[derive(Debug, Deserialize)]
struct DatabaseSection {
user: String,
password: String,
}
fn main() -> Result<(), std::io::Error> {
let cfg = IniParserConfig::default();
let parsed: Config = from_ini_file("config.ini", &cfg)?;
println!("Port: {}", parsed.server.port);
Ok(())
}
While not no_std, inihx is lightweight and efficient enough for use in embedded Linux environments such as:
It avoids unnecessary dependencies and is suitable for memory-constrained systems that use std.
Licensed under either of:
LICENSE)LICENSE-BSD)