use super::runtime::*; use super::parser::*; use std::error::Error; use std::collections::HashMap; fn cat_vec(arr: Vec) -> String { let total_len: usize = arr.iter().map(|s| { s.len() }).sum(); arr.into_iter().fold(String::with_capacity(total_len), |mut acc, p| { acc.push_str(p.as_str()); acc }) } /* This function is supposed to compile all elements in one particular file */ pub fn plemege_to_value(mut x: Plemege, file_path: &str) -> Result> { match x { Plemege::Package(map) => { let mut new_dict: HashMap = HashMap::new(); for (key, thing) in map { new_dict.insert(key, plemege_to_value(thing, file_path)?); } Ok(Value::Dict(new_dict)) }, Plemege::Element(el) => { // Rc::new(|d_state: &DebugState, _: &Value, _: &Value, args: &[&Value]|) // todo Ok(Value::default()) } } }