pub mod error;
mod head_skipping;
pub mod main;
mod tail_skipping;
pub use main::MainEngine as RsonpathEngine;
use self::error::EngineError;
use crate::{
input::Input,
query::{automaton::Automaton, error::CompilerError, JsonPathQuery},
result::{Match, MatchCount, MatchIndex, Sink},
};
pub trait Engine {
fn count<I>(&self, input: &I) -> Result<MatchCount, EngineError>
where
I: Input;
fn indices<I, S>(&self, input: &I, sink: &mut S) -> Result<(), EngineError>
where
I: Input,
S: Sink<MatchIndex>;
fn matches<I, S>(&self, input: &I, sink: &mut S) -> Result<(), EngineError>
where
I: Input,
S: Sink<Match>;
}
pub trait Compiler {
type E<'q>: Engine + 'q;
fn compile_query(query: &JsonPathQuery) -> Result<Self::E<'_>, CompilerError>;
fn from_compiled_query(automaton: Automaton<'_>) -> Self::E<'_>;
}