DottedTreeToJson

Trait DottedTreeToJson 

Source
pub trait DottedTreeToJson {
    // Required method
    fn dotted_tree_to_json(&self) -> Result<Value, String>;
}

Required Methods§

Implementations on Foreign Types§

Source§

impl DottedTreeToJson for String

Source§

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());

Implementors§