pub trait EndoPlan: Endo<LogicalPlanRef> {
// Required method
fn cached<F>(&mut self, plan: LogicalPlanRef, f: F) -> LogicalPlanRef
where F: FnMut(&mut Self) -> LogicalPlanRef;
// Provided method
fn dag_apply(&mut self, plan: LogicalPlanRef) -> LogicalPlanRef { ... }
}Expand description
A more sophisticated Endo taking into account of the DAG structure of PlanRef.
In addition to Endo, one have to specify the cached function
to persist transformed LogicalShare and their results,
and the dag_apply function will take care to only transform every LogicalShare nodes once.
Note: Due to the way super trait is designed in rust,
one need to have separate implementation blocks of Endo<PlanRef> and EndoPlan.
And conventionally the real transformation apply is under Endo<PlanRef>,
although one can refer to dag_apply in the implementation of apply.
Required Methods§
fn cached<F>(&mut self, plan: LogicalPlanRef, f: F) -> LogicalPlanRefwhere
F: FnMut(&mut Self) -> LogicalPlanRef,
Provided Methods§
fn dag_apply(&mut self, plan: LogicalPlanRef) -> LogicalPlanRef
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.