libRustConfig
It is rust bindings and wrapper around libconfig library. Library for processing configuration files.
Table of contents
Requirements
Library is writing used latest stable Rust Compiler (rustc 1.46.0 (04488afe3 2020-08-24)).
Installation
Add this to your Cargo.toml
:
[]
= "0.1.*"
Usage
Add to your crate root:
extern crate config;
Bindings
libconfig-sys crate contains the libconfig translated headers to use this library in Rust programs.
Wrapper
libconfig crate contains the libconfig safe wrapper.
Usage example
Create
use ;
use Path;
let mut cfg = new;
if cfg.load_from_string.is_err
Insert
let group = cfg.create_section;
if group.is_none
if group.unwrap.write_string.is_none
Insert group
let array = group.create_array;
if array.is_none
if array.write_int32.is_none
Search
if !cfg.value.unwrap.is_section.unwrap
let _int_val = cfg.value.unwrap.as_int32;
if int_val.is_none
match cfg.value.unwrap.value_type.unwrap
Search default
let _bool_val = cfg.value.unwrap.as_bool_default;
Iterate
for arr_val in cfg.value.unwrap.as_array
Save
if cfg.save_to_file.is_err