@@ -6,35 +6,11 @@ use std::fmt;
66pub use vortex_utils:: tree:: DepthContext as PlanTreeContext ;
77pub use vortex_utils:: tree:: IndentedFormatter as PlanIndentedFormatter ;
88use vortex_utils:: tree:: TreeDisplayAdapter ;
9+ pub use vortex_utils:: tree:: TreeDisplayExtractor as PlanTreeExtractor ;
910use vortex_utils:: tree:: write_indented_tree;
1011
1112use super :: DynPlan ;
1213
13- /// Contributes one composable dimension of information to plan tree nodes.
14- pub trait PlanTreeExtractor : Send + Sync {
15- /// Writes space-prefixed annotations on the node's header line.
16- fn write_header (
17- & self ,
18- plan : & dyn DynPlan ,
19- context : & PlanTreeContext ,
20- formatter : & mut fmt:: Formatter < ' _ > ,
21- ) -> fmt:: Result {
22- let _ = ( plan, context, formatter) ;
23- Ok ( ( ) )
24- }
25-
26- /// Writes detail lines beneath the node's header.
27- fn write_details (
28- & self ,
29- plan : & dyn DynPlan ,
30- context : & PlanTreeContext ,
31- formatter : & mut PlanIndentedFormatter < ' _ , ' _ > ,
32- ) -> fmt:: Result {
33- let _ = ( plan, context, formatter) ;
34- Ok ( ( ) )
35- }
36- }
37-
3814/// Adds the plan's display representation to a tree node's header.
3915pub struct PlanSummaryExtractor ;
4016
@@ -45,7 +21,7 @@ impl PlanSummaryExtractor {
4521 }
4622}
4723
48- impl PlanTreeExtractor for PlanSummaryExtractor {
24+ impl PlanTreeExtractor < dyn DynPlan , PlanTreeContext > for PlanSummaryExtractor {
4925 fn write_header (
5026 & self ,
5127 plan : & dyn DynPlan ,
@@ -63,7 +39,7 @@ impl PlanTreeExtractor for PlanSummaryExtractor {
6339/// start with only node and child names, then add extractors with [`Self::with`].
6440pub struct PlanTreeDisplay < ' a > {
6541 plan : & ' a dyn DynPlan ,
66- extractors : Vec < Box < dyn PlanTreeExtractor > > ,
42+ extractors : Vec < Box < dyn PlanTreeExtractor < dyn DynPlan , PlanTreeContext > > > ,
6743}
6844
6945impl < ' a > PlanTreeDisplay < ' a > {
@@ -81,13 +57,19 @@ impl<'a> PlanTreeDisplay<'a> {
8157 }
8258
8359 /// Adds an extractor to the display pipeline.
84- pub fn with < E : PlanTreeExtractor + ' static > ( mut self , extractor : E ) -> Self {
60+ pub fn with < E : PlanTreeExtractor < dyn DynPlan , PlanTreeContext > + ' static > (
61+ mut self ,
62+ extractor : E ,
63+ ) -> Self {
8564 self . extractors . push ( Box :: new ( extractor) ) ;
8665 self
8766 }
8867
8968 /// Adds a pre-boxed extractor to the display pipeline.
90- pub fn with_boxed ( mut self , extractor : Box < dyn PlanTreeExtractor > ) -> Self {
69+ pub fn with_boxed (
70+ mut self ,
71+ extractor : Box < dyn PlanTreeExtractor < dyn DynPlan , PlanTreeContext > > ,
72+ ) -> Self {
9173 self . extractors . push ( extractor) ;
9274 self
9375 }
0 commit comments