jsonpath_lib2 0.3.3

An updated fork of jsonpath_lib. The original crate has not been updated since 2021 Jun 03. It is JsonPath engine written in Rust. It provide a similar API interface in Webassembly and Javascript too. - Webassembly Demo: https://freestrings.github.io/jsonpath Feel free to transfer maintenance for this crate if I don't respond for one year. I consent to the transfer of this crate to the first person who asks help@crates.io for it.
Documentation
#[macro_use]
extern crate serde_json;
extern crate jsonpath_lib;

use common::setup;
use jsonpath_lib::PathCompiled;
use serde_json::Value;

mod common;

#[test]
fn precompile_test() {
    setup();

    let json = json!({
        "foo": {"bar": "baz"}
    });

    // compile once

    let compiled = PathCompiled::compile("$.foo.bar");

    assert!(compiled.is_ok());

    let compiled = compiled.unwrap();

    // re-use

    //let result = compiled(&json).unwrap();
    assert_eq!(
        compiled.select(&json).unwrap().clone(),
        vec![&Value::String("baz".into())]
    );
    assert_eq!(
        compiled.select(&json).unwrap().clone(),
        vec![&Value::String("baz".into())]
    );
}

#[test]
fn precompile_failure() {
    setup();

    let compiled = PathCompiled::compile("");

    assert!(compiled.is_err());
}