Crates.io | yaml_file_handler |
lib.rs | yaml_file_handler |
version | 0.1.4 |
source | src |
created_at | 2015-10-21 19:48:10.986814 |
updated_at | 2015-12-16 00:01:56.610782 |
description | A Yaml File Handler based on yaml-rust |
homepage | https://github.com/JeanDenisVIDOT/yaml_file_handler |
repository | |
max_upload_size | |
id | 3279 |
size | 3,285 |
A Yaml File Handler written in Rust. Based on Yaml implementation of [Chyh1990] (https://github.com/chyh1990/yaml-rust)
## How to use it
Cargo.toml
yaml_file_handler = "0.1.3"
Simple example:
extern crate yaml_rust;
pub mod yaml_handler;
use yaml_handler::FileHandler;
#[test]
fn it_works() {
let mut handler = FileHandler::new();
handler.add_files(vec![
"parameters.yml",
"routing.yml"
]);
let config = match handler.read_all_files() {
Some(data) => data,
None => return,
};
println!("config['parameters']['server']['hostname'] = {}", config["parameters"]["server"]["hostname"].as_str().unwrap());
}