parse_sample/
parse_sample.rs1use led_rs::*;
2use std::fs::File;
3use std::io::prelude::*;
4use std::path::PathBuf;
5
6fn parse_file(file_name: &str) -> Project {
8 let mut file_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
9 file_path.push("examples");
10 file_path.push(file_name);
11 file_path.set_extension("json");
12
13 let mut file = File::open(file_path).unwrap();
14 let mut contents = String::new();
15 file.read_to_string(&mut contents).unwrap();
16
17 Project::parse_json(contents).unwrap()
18}
19
20fn main() {
21 println!("{:?}", parse_file("autolayers_advanced_demo"));
22 println!("{:?}", parse_file("simple_with_array"));
23}