|
1 | | -use std::{ |
2 | | - collections::HashMap, |
3 | | - sync::{Arc, Mutex}, |
4 | | -}; |
| 1 | +use std::{collections::HashMap, sync::Mutex}; |
5 | 2 |
|
6 | 3 | use egglog::{ |
7 | 4 | ast::{Expr, Fact, Facts, Literal, ParseError}, |
@@ -199,35 +196,18 @@ impl ScheduleState { |
199 | 196 | } |
200 | 197 | } |
201 | 198 |
|
202 | | -#[derive(Debug, Clone)] |
203 | | -struct RunExtendedScheduleOutput { |
204 | | - reports: Vec<RunReport>, |
205 | | -} |
206 | | - |
207 | | -impl std::fmt::Display for RunExtendedScheduleOutput { |
208 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
209 | | - writeln!(f, "Ran schedules:")?; |
210 | | - for report in &self.reports { |
211 | | - writeln!(f, "{}", report)?; |
212 | | - } |
213 | | - Ok(()) |
214 | | - } |
215 | | -} |
216 | | - |
217 | 199 | impl UserDefinedCommand for RunExtendedSchedule { |
218 | 200 | fn update( |
219 | 201 | &self, |
220 | 202 | egraph: &mut egglog::EGraph, |
221 | 203 | args: &[Expr], |
222 | 204 | ) -> Result<Option<CommandOutput>, egglog::Error> { |
223 | 205 | let mut schedule = ScheduleState::new(); |
224 | | - let mut reports = Vec::new(); |
| 206 | + let mut report = RunReport::default(); |
225 | 207 | for arg in args { |
226 | | - reports.push(schedule.run(egraph, arg)?); |
| 208 | + report.union(schedule.run(egraph, arg)?); |
227 | 209 | } |
228 | | - Ok(Some(CommandOutput::UserDefined(Arc::new( |
229 | | - RunExtendedScheduleOutput { reports }, |
230 | | - )))) |
| 210 | + Ok(Some(CommandOutput::RunSchedule(report))) |
231 | 211 | } |
232 | 212 | } |
233 | 213 |
|
|
0 commit comments