Crates.io | confget |
lib.rs | confget |
version | 5.1.2 |
source | src |
created_at | 2021-05-12 08:27:40.634074 |
updated_at | 2023-08-26 19:47:26.670123 |
description | Parse configuration files. |
homepage | https://devel.ringlet.net/textproc/confget/ |
repository | https://gitlab.com/confget/confget |
max_upload_size | |
id | 396447 |
size | 87,455 |
The confget
library parses configuration files (currently INI-style
files only) and allows a program to use the values defined in them.
It provides various options for selecting the variable names and
values to return and the configuration file sections to fetch them from.
The confget
library may also be used as a command-line tool with
the same interface as the C implementation.
The read_ini_file()
function will parse
an INI-style file and return a hashmap of the values found in its
various sections, as well as the name of the first section found in
the file (or the one specified in the configuration if
the section_override
option
is enabled).
use confget;
// Default configuration except for the filename.
let config = confget::Config {
filename: Some("/etc/config.ini".to_string()),
..confget::Config::default()
};
let data, first_section = confget::read_ini_file(&config)?;
For the crate's change history, see the CHANGES file in the source distribution.
Author: Peter Pentchev <roam@ringlet.net>