Skip to main content

graphrecords_query/operands/
context.rs

1use crate::{
2    EvaluateOperand, Explain, Operand, QueryResult,
3    execution::EvaluationCache,
4    optimizer::{Estimated, OptimizePlan, PlanNode},
5};
6use graphrecords_core::GraphRecord;
7
8pub trait EvaluateContext {
9    type Operand: Operand;
10
11    fn evaluate<'a>(
12        &'a self,
13        graphrecord: &'a GraphRecord,
14        cache: &'a EvaluationCache<'a>,
15    ) -> QueryResult<<Self::Operand as EvaluateOperand>::ReturnValue<'a>>;
16}
17
18pub trait OperandContext<O: Operand>:
19    PlanNode
20    + OptimizePlan<Output = O>
21    + Explain
22    + EvaluateContext<Operand = O>
23    + Estimated
24    + Send
25    + Sync
26{
27}
28
29impl<O, C> OperandContext<O> for C
30where
31    O: Operand,
32    C: PlanNode
33        + OptimizePlan<Output = O>
34        + Explain
35        + EvaluateContext<Operand = O>
36        + Estimated
37        + Send
38        + Sync,
39{
40}