You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent a lot of time reading cmds/jrsonnet/src/main.rs and libraries source code to be able to make this quick start example, so I guess it would help other people as well to have a minimal example to start with!
I've written this code for 0.4.2.
Maybe this could be added to the README or somewhere in the doc?
use std::path::PathBuf;use jrsonnet_evaluator::{error::LocError,EvaluationState,FileImportResolver};pubfnfrom_path(path:&PathBuf) -> Result<String,String>{let state = EvaluationState::default();
state.with_stdlib();
state.set_import_resolver(Box::new(FileImportResolver::default()));matchevaluate(path,&state){Ok(val) => Ok(val),Err(err) => Err(state.stringify_err(&err)),}}fnevaluate(path:&PathBuf,state:&EvaluationState) -> Result<String,LocError>{let val = state.evaluate_file_raw(path)?;let result = state.manifest(val)?;Ok(result.to_string())}
The text was updated successfully, but these errors were encountered:
ppom0
changed the title
Add quick information in README
Add quick start information in README
Jun 9, 2024
I spent a lot of time reading
cmds/jrsonnet/src/main.rs
and libraries source code to be able to make this quick start example, so I guess it would help other people as well to have a minimal example to start with!I've written this code for 0.4.2.
Maybe this could be added to the README or somewhere in the doc?
The text was updated successfully, but these errors were encountered: