Description
Panic during the capture function of the builtin.rs
Steps to Reproduce
- The following code to be included in the main.rs
use jslt::Jslt;
use serde_json::json;
use std::fs;
fn main() -> Result<(), Box <dyn std::error::Error> > {
let jslt: Jslt = r#"
let val = "Hi_there"
let options = {
let option = capture($val, "^(?<key>[^_]+)_(?<val>.+)$")
$option.key : $option.val
}
$options
"#.parse()?;
let input = json!({
"data": [
[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10]
]
});
let output = jslt.transform_value(&input)?;
println!("{}",output);
assert_eq!("{\"Hi\":\"there\"}",output.to_string());
Ok(())
}
Actual Output
thread 'main' panicked at jslt_dev/jslt/src/transform/value.rs:275:34: no entry found for key note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Expected Output
{"Hi":"there"}
Environment
Nightly Rust Toolchain
Description
Panic during the capture function of the builtin.rs
Steps to Reproduce
use jslt::Jslt; use serde_json::json; use std::fs; fn main() -> Result<(), Box <dyn std::error::Error> > { let jslt: Jslt = r#" let val = "Hi_there" let options = { let option = capture($val, "^(?<key>[^_]+)_(?<val>.+)$") $option.key : $option.val } $options "#.parse()?; let input = json!({ "data": [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10] ] }); let output = jslt.transform_value(&input)?; println!("{}",output); assert_eq!("{\"Hi\":\"there\"}",output.to_string()); Ok(()) }Actual Output
thread 'main' panicked at jslt_dev/jslt/src/transform/value.rs:275:34: no entry found for key note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Expected Output
{"Hi":"there"}
Environment
Nightly Rust Toolchain