pub trait DottedTreeToJson {
// Required method
fn dotted_tree_to_json(&self) -> Result<Value, String>;
}Required Methods§
fn dotted_tree_to_json(&self) -> Result<Value, String>
Implementations on Foreign Types§
Source§impl DottedTreeToJson for String
impl DottedTreeToJson for String
Source§fn dotted_tree_to_json(&self) -> Result<Value, String>
fn dotted_tree_to_json(&self) -> Result<Value, String>
Convert a dotted tree String into a Json Document
§Example usage
use std::{fs::File, io::Read};
use nparse::DottedTreeToJson;
let path = "data/sysctl.txt";
let mut out = String::new();
{
let mut f = File::open(path).unwrap();
f.read_to_string(&mut out).unwrap();
}
let result = out.dotted_tree_to_json();
println!("{:#?}", result.unwrap());