Skip to main content

jsonpath_rust/query/
test.rs

1use crate::parser::model::Test;
2use crate::query::context::JsonPathEvalContext;
3use crate::query::queryable::Queryable;
4use crate::query::state::State;
5use crate::query::Query;
6
7impl Query for Test {
8    fn process_with_context<'a, T: Queryable>(
9        &self,
10        state: State<'a, T>,
11        ctx: &mut JsonPathEvalContext,
12    ) -> State<'a, T> {
13        match self {
14            Test::RelQuery(segments) => segments.process_with_context(state, ctx),
15            Test::AbsQuery(jquery) => jquery.process_with_context(state.shift_to_root(), ctx),
16            Test::Function(tf) => tf.process_with_context(state, ctx),
17        }
18    }
19}