Skip to content

Commit f971a7c

Browse files
committed
add impl TaskEstimator for Arc<&dyn TaskEstimator>
1 parent 5e671e0 commit f971a7c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/distributed_planner/task_estimator.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,26 @@ impl TaskEstimator for usize {
6060
}
6161
}
6262

63+
impl TaskEstimator for Arc<dyn TaskEstimator> {
64+
fn estimate_tasks(
65+
&self,
66+
plan: &Arc<dyn ExecutionPlan>,
67+
cfg: &ConfigOptions,
68+
) -> Option<TaskEstimation> {
69+
self.as_ref().estimate_tasks(plan, cfg)
70+
}
71+
}
72+
73+
impl TaskEstimator for Arc<dyn TaskEstimator + Send + Sync> {
74+
fn estimate_tasks(
75+
&self,
76+
plan: &Arc<dyn ExecutionPlan>,
77+
cfg: &ConfigOptions,
78+
) -> Option<TaskEstimation> {
79+
self.as_ref().estimate_tasks(plan, cfg)
80+
}
81+
}
82+
6383
impl<F: Fn(&Arc<dyn ExecutionPlan>, &ConfigOptions) -> Option<TaskEstimation>> TaskEstimator for F {
6484
fn estimate_tasks(
6585
&self,

0 commit comments

Comments
 (0)