pub fn query_count(
doc: &Document,
path: &str,
config: &QueryConfig,
) -> QueryResult<usize>Expand description
Count the number of matches for a JSONPath query
§Arguments
doc- The HEDL document to querypath-JSONPathexpressionconfig- Query configuration
§Returns
Number of matching elements
§Examples
use hedl_json::jsonpath::{query_count, QueryConfig};
use hedl_core::Document;
# fn example() -> Result<(), Box<dyn std::error::Error>> {
let doc = hedl_core::parse_hedl("items: [1, 2, 3]")?;
let config = QueryConfig::default();
let count = query_count(&doc, "$.items[*]", &config)?;
assert_eq!(count, 3);
# Ok(())
# }