git.delta.rocks / jrsonnet / refs/commits / a75f77f8f37a

difftreelog

feat(evaluator) utility methods for bindings

Лач2020-06-27parent: #2cabc72.patch.diff
in: master

2 files changed

modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
116 ..Default::default()116 ..Default::default()
117 }))117 }))
118 }118 }
119 pub fn evaluate_file_to_json(
120 &self,
121 path: &PathBuf,
122 ) -> std::result::Result<Rc<str>, LocError> {
123 self.import_file(&PathBuf::new(), &path).and_then(|v|v.into_json(4))
124 }
119 pub fn add_file(125 pub fn add_file(
120 &self,126 &self,
121 name: Rc<PathBuf>,127 name: Rc<PathBuf>,
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -52,6 +52,9 @@
 			value_cache: RefCell::new(HashMap::new()),
 		}))
 	}
+	pub fn new_empty() -> ObjValue {
+		Self::new(None, Rc::new(BTreeMap::new()))
+	}
 	pub fn with_super(&self, super_obj: ObjValue) -> ObjValue {
 		match &self.0.super_obj {
 			None => ObjValue::new(Some(super_obj), self.0.this_entries.clone()),