diff --git a/src/autorouter/autoroute.rs b/src/autorouter/autoroute.rs index cb0d258..e7a4744 100644 --- a/src/autorouter/autoroute.rs +++ b/src/autorouter/autoroute.rs @@ -30,14 +30,14 @@ impl TryInto<()> for AutorouteStatus { } } -pub struct AutorouteCommandStepper { +pub struct AutorouteExecutionStepper { ratlines_iter: Box>>, options: AutorouterOptions, route: Option, curr_ratline: Option>, } -impl AutorouteCommandStepper { +impl AutorouteExecutionStepper { pub fn new( autorouter: &mut Autorouter, ratlines: impl IntoIterator> + 'static, @@ -64,7 +64,7 @@ impl AutorouteCommandStepper { } impl Step, AutorouteStatus, AutorouterError, ()> - for AutorouteCommandStepper + for AutorouteExecutionStepper { fn step(&mut self, autorouter: &mut Autorouter) -> Result { let Some(curr_ratline) = self.curr_ratline else { @@ -119,25 +119,25 @@ impl Step, AutorouteStatus, AutorouterError, () } } -impl GetMaybeNavmesh for AutorouteCommandStepper { +impl GetMaybeNavmesh for AutorouteExecutionStepper { fn maybe_navmesh(&self) -> Option<&Navmesh> { self.route.as_ref().map(|route| route.navmesh()) } } -impl GetMaybeTrace for AutorouteCommandStepper { +impl GetMaybeTrace for AutorouteExecutionStepper { fn maybe_trace(&self) -> Option<&TraceStepper> { self.route.as_ref().map(|route| route.trace()) } } -impl GetGhosts for AutorouteCommandStepper { +impl GetGhosts for AutorouteExecutionStepper { fn ghosts(&self) -> &[PrimitiveShape] { self.route.as_ref().map_or(&[], |route| route.ghosts()) } } -impl GetObstacles for AutorouteCommandStepper { +impl GetObstacles for AutorouteExecutionStepper { fn obstacles(&self) -> &[PrimitiveIndex] { self.route.as_ref().map_or(&[], |route| route.obstacles()) } diff --git a/src/autorouter/autorouter.rs b/src/autorouter/autorouter.rs index 9bd7235..cbf05d7 100644 --- a/src/autorouter/autorouter.rs +++ b/src/autorouter/autorouter.rs @@ -16,12 +16,12 @@ use crate::{ }; use super::{ - autoroute::AutorouteCommandStepper, - compare_detours::CompareDetoursCommandStepper, - measure_length::MeasureLengthCommandStepper, - place_via::PlaceViaCommandStepper, + autoroute::AutorouteExecutionStepper, + compare_detours::CompareDetoursExecutionStepper, + measure_length::MeasureLengthExecutionStepper, + place_via::PlaceViaExecutionStepper, ratsnest::{Ratsnest, RatvertexIndex}, - remove_bands::RemoveBandsCommandStepper, + remove_bands::RemoveBandsExecutionStepper, selection::{BandSelection, PinSelection}, }; @@ -62,7 +62,7 @@ impl Autorouter { &mut self, selection: &PinSelection, options: AutorouterOptions, - ) -> Result { + ) -> Result { self.autoroute_ratlines(self.selected_ratlines(selection), options) } @@ -70,8 +70,8 @@ impl Autorouter { &mut self, ratlines: Vec>, options: AutorouterOptions, - ) -> Result { - AutorouteCommandStepper::new(self, ratlines, options) + ) -> Result { + AutorouteExecutionStepper::new(self, ratlines, options) } pub fn undo_autoroute(&mut self, selection: &PinSelection) -> Result<(), AutorouterError> { @@ -99,8 +99,8 @@ impl Autorouter { Ok(()) } - pub fn place_via(&self, weight: ViaWeight) -> Result { - PlaceViaCommandStepper::new(weight) + pub fn place_via(&self, weight: ViaWeight) -> Result { + PlaceViaExecutionStepper::new(weight) } pub fn undo_place_via(&mut self, _weight: ViaWeight) { @@ -110,8 +110,8 @@ impl Autorouter { pub fn remove_bands( &self, selection: &BandSelection, - ) -> Result { - RemoveBandsCommandStepper::new(selection) + ) -> Result { + RemoveBandsExecutionStepper::new(selection) } pub fn undo_remove_bands(&mut self, _selection: &BandSelection) { @@ -122,7 +122,7 @@ impl Autorouter { &mut self, selection: &PinSelection, options: AutorouterOptions, - ) -> Result { + ) -> Result { let ratlines = self.selected_ratlines(selection); let ratline1 = *ratlines .get(0) @@ -138,15 +138,15 @@ impl Autorouter { ratline1: EdgeIndex, ratline2: EdgeIndex, options: AutorouterOptions, - ) -> Result { - CompareDetoursCommandStepper::new(self, ratline1, ratline2, options) + ) -> Result { + CompareDetoursExecutionStepper::new(self, ratline1, ratline2, options) } pub fn measure_length( &mut self, selection: &BandSelection, - ) -> Result { - MeasureLengthCommandStepper::new(selection) + ) -> Result { + MeasureLengthExecutionStepper::new(selection) } pub fn ratline_endpoints( diff --git a/src/autorouter/command.rs b/src/autorouter/command.rs index 8077f1d..cae54de 100644 --- a/src/autorouter/command.rs +++ b/src/autorouter/command.rs @@ -4,12 +4,12 @@ use serde::{Deserialize, Serialize}; use crate::{board::mesadata::AccessMesadata, layout::via::ViaWeight, step::Step}; use super::{ - autoroute::{AutorouteCommandStepper, AutorouteStatus}, - compare_detours::{CompareDetoursCommandStepper, CompareDetoursStatus}, + autoroute::{AutorouteExecutionStepper, AutorouteStatus}, + compare_detours::{CompareDetoursExecutionStepper, CompareDetoursStatus}, invoker::{Invoker, InvokerError, InvokerStatus}, - measure_length::MeasureLengthCommandStepper, - place_via::PlaceViaCommandStepper, - remove_bands::RemoveBandsCommandStepper, + measure_length::MeasureLengthExecutionStepper, + place_via::PlaceViaExecutionStepper, + remove_bands::RemoveBandsExecutionStepper, selection::{BandSelection, PinSelection}, AutorouterOptions, }; @@ -26,21 +26,21 @@ pub enum Command { } #[enum_dispatch(GetMaybeNavmesh, GetMaybeTrace, GetGhosts, GetObstacles)] -pub enum CommandStepper { - Autoroute(AutorouteCommandStepper), - PlaceVia(PlaceViaCommandStepper), - RemoveBands(RemoveBandsCommandStepper), - CompareDetours(CompareDetoursCommandStepper), - MeasureLength(MeasureLengthCommandStepper), +pub enum ExecutionStepper { + Autoroute(AutorouteExecutionStepper), + PlaceVia(PlaceViaExecutionStepper), + RemoveBands(RemoveBandsExecutionStepper), + CompareDetours(CompareDetoursExecutionStepper), + MeasureLength(MeasureLengthExecutionStepper), } -impl CommandStepper { +impl ExecutionStepper { fn step_catch_err( &mut self, invoker: &mut Invoker, ) -> Result { match self { - CommandStepper::Autoroute(autoroute) => { + ExecutionStepper::Autoroute(autoroute) => { match autoroute.step(&mut invoker.autorouter)? { AutorouteStatus::Running => Ok(InvokerStatus::Running), AutorouteStatus::Routed(..) => Ok(InvokerStatus::Running), @@ -49,19 +49,19 @@ impl CommandStepper { ))), } } - CommandStepper::PlaceVia(place_via) => { + ExecutionStepper::PlaceVia(place_via) => { place_via.doit(&mut invoker.autorouter)?; Ok(InvokerStatus::Finished(String::from( "finished placing via", ))) } - CommandStepper::RemoveBands(remove_bands) => { + ExecutionStepper::RemoveBands(remove_bands) => { remove_bands.doit(&mut invoker.autorouter)?; Ok(InvokerStatus::Finished(String::from( "finished removing bands", ))) } - CommandStepper::CompareDetours(compare_detours) => { + ExecutionStepper::CompareDetours(compare_detours) => { match compare_detours.step(&mut invoker.autorouter)? { CompareDetoursStatus::Running => Ok(InvokerStatus::Running), CompareDetoursStatus::Finished(total_length1, total_length2) => { @@ -72,7 +72,7 @@ impl CommandStepper { } } } - CommandStepper::MeasureLength(measure_length) => { + ExecutionStepper::MeasureLength(measure_length) => { let length = measure_length.doit(&mut invoker.autorouter)?; Ok(InvokerStatus::Finished(format!( "Total length of selected bands: {}", @@ -83,7 +83,7 @@ impl CommandStepper { } } -impl Step, InvokerStatus, InvokerError, ()> for CommandStepper { +impl Step, InvokerStatus, InvokerError, ()> for ExecutionStepper { fn step(&mut self, invoker: &mut Invoker) -> Result { match self.step_catch_err(invoker) { Ok(InvokerStatus::Running) => Ok(InvokerStatus::Running), diff --git a/src/autorouter/compare_detours.rs b/src/autorouter/compare_detours.rs index 6da6ced..1deb5c6 100644 --- a/src/autorouter/compare_detours.rs +++ b/src/autorouter/compare_detours.rs @@ -10,7 +10,7 @@ use crate::{ }; use super::{ - autoroute::{AutorouteCommandStepper, AutorouteStatus}, + autoroute::{AutorouteExecutionStepper, AutorouteStatus}, invoker::{GetGhosts, GetMaybeNavmesh, GetMaybeTrace, GetObstacles}, Autorouter, AutorouterError, AutorouterOptions, }; @@ -32,9 +32,9 @@ impl TryInto<(f64, f64)> for CompareDetoursStatus { } } -pub struct CompareDetoursCommandStepper { - autoroute: AutorouteCommandStepper, - next_autoroute: Option, +pub struct CompareDetoursExecutionStepper { + autoroute: AutorouteExecutionStepper, + next_autoroute: Option, ratline1: EdgeIndex, ratline2: EdgeIndex, total_length1: f64, @@ -42,7 +42,7 @@ pub struct CompareDetoursCommandStepper { done: bool, } -impl CompareDetoursCommandStepper { +impl CompareDetoursExecutionStepper { pub fn new( autorouter: &mut Autorouter, ratline1: EdgeIndex, @@ -64,7 +64,7 @@ impl CompareDetoursCommandStepper { // XXX: Do we really need this to be a stepper? We don't use at the moment, as sorting functions // aren't steppable either. It may be useful for debugging later on tho. impl Step, CompareDetoursStatus, AutorouterError, (f64, f64)> - for CompareDetoursCommandStepper + for CompareDetoursExecutionStepper { fn step( &mut self, @@ -112,25 +112,25 @@ impl Step, CompareDetoursStatus, AutorouterErro } } -impl GetMaybeNavmesh for CompareDetoursCommandStepper { +impl GetMaybeNavmesh for CompareDetoursExecutionStepper { fn maybe_navmesh(&self) -> Option<&Navmesh> { self.autoroute.maybe_navmesh() } } -impl GetMaybeTrace for CompareDetoursCommandStepper { +impl GetMaybeTrace for CompareDetoursExecutionStepper { fn maybe_trace(&self) -> Option<&TraceStepper> { self.autoroute.maybe_trace() } } -impl GetGhosts for CompareDetoursCommandStepper { +impl GetGhosts for CompareDetoursExecutionStepper { fn ghosts(&self) -> &[PrimitiveShape] { self.autoroute.ghosts() } } -impl GetObstacles for CompareDetoursCommandStepper { +impl GetObstacles for CompareDetoursExecutionStepper { fn obstacles(&self) -> &[PrimitiveIndex] { self.autoroute.obstacles() } diff --git a/src/autorouter/execution.rs b/src/autorouter/execution.rs new file mode 100644 index 0000000..cae54de --- /dev/null +++ b/src/autorouter/execution.rs @@ -0,0 +1,103 @@ +use enum_dispatch::enum_dispatch; +use serde::{Deserialize, Serialize}; + +use crate::{board::mesadata::AccessMesadata, layout::via::ViaWeight, step::Step}; + +use super::{ + autoroute::{AutorouteExecutionStepper, AutorouteStatus}, + compare_detours::{CompareDetoursExecutionStepper, CompareDetoursStatus}, + invoker::{Invoker, InvokerError, InvokerStatus}, + measure_length::MeasureLengthExecutionStepper, + place_via::PlaceViaExecutionStepper, + remove_bands::RemoveBandsExecutionStepper, + selection::{BandSelection, PinSelection}, + AutorouterOptions, +}; + +type Type = PinSelection; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum Command { + Autoroute(PinSelection, AutorouterOptions), + PlaceVia(ViaWeight), + RemoveBands(BandSelection), + CompareDetours(Type, AutorouterOptions), + MeasureLength(BandSelection), +} + +#[enum_dispatch(GetMaybeNavmesh, GetMaybeTrace, GetGhosts, GetObstacles)] +pub enum ExecutionStepper { + Autoroute(AutorouteExecutionStepper), + PlaceVia(PlaceViaExecutionStepper), + RemoveBands(RemoveBandsExecutionStepper), + CompareDetours(CompareDetoursExecutionStepper), + MeasureLength(MeasureLengthExecutionStepper), +} + +impl ExecutionStepper { + fn step_catch_err( + &mut self, + invoker: &mut Invoker, + ) -> Result { + match self { + ExecutionStepper::Autoroute(autoroute) => { + match autoroute.step(&mut invoker.autorouter)? { + AutorouteStatus::Running => Ok(InvokerStatus::Running), + AutorouteStatus::Routed(..) => Ok(InvokerStatus::Running), + AutorouteStatus::Finished => Ok(InvokerStatus::Finished(String::from( + "finished autorouting", + ))), + } + } + ExecutionStepper::PlaceVia(place_via) => { + place_via.doit(&mut invoker.autorouter)?; + Ok(InvokerStatus::Finished(String::from( + "finished placing via", + ))) + } + ExecutionStepper::RemoveBands(remove_bands) => { + remove_bands.doit(&mut invoker.autorouter)?; + Ok(InvokerStatus::Finished(String::from( + "finished removing bands", + ))) + } + ExecutionStepper::CompareDetours(compare_detours) => { + match compare_detours.step(&mut invoker.autorouter)? { + CompareDetoursStatus::Running => Ok(InvokerStatus::Running), + CompareDetoursStatus::Finished(total_length1, total_length2) => { + Ok(InvokerStatus::Finished(String::from(format!( + "total detour lengths are {} and {}", + total_length1, total_length2 + )))) + } + } + } + ExecutionStepper::MeasureLength(measure_length) => { + let length = measure_length.doit(&mut invoker.autorouter)?; + Ok(InvokerStatus::Finished(format!( + "Total length of selected bands: {}", + length + ))) + } + } + } +} + +impl Step, InvokerStatus, InvokerError, ()> for ExecutionStepper { + fn step(&mut self, invoker: &mut Invoker) -> Result { + match self.step_catch_err(invoker) { + Ok(InvokerStatus::Running) => Ok(InvokerStatus::Running), + Ok(InvokerStatus::Finished(msg)) => { + if let Some(command) = invoker.ongoing_command.take() { + invoker.history.do_(command); + } + + Ok(InvokerStatus::Finished(msg)) + } + Err(err) => { + invoker.ongoing_command = None; + Err(err) + } + } + } +} diff --git a/src/autorouter/invoker.rs b/src/autorouter/invoker.rs index 3568fb5..e623ea5 100644 --- a/src/autorouter/invoker.rs +++ b/src/autorouter/invoker.rs @@ -13,13 +13,13 @@ use crate::{ }; use super::{ - autoroute::AutorouteCommandStepper, - command::{Command, CommandStepper}, - compare_detours::CompareDetoursCommandStepper, + autoroute::AutorouteExecutionStepper, + command::{Command, ExecutionStepper}, + compare_detours::CompareDetoursExecutionStepper, history::{History, HistoryError}, - measure_length::MeasureLengthCommandStepper, - place_via::PlaceViaCommandStepper, - remove_bands::RemoveBandsCommandStepper, + measure_length::MeasureLengthExecutionStepper, + place_via::PlaceViaExecutionStepper, + remove_bands::RemoveBandsExecutionStepper, Autorouter, AutorouterError, }; @@ -108,14 +108,14 @@ impl Invoker { } #[debug_requires(self.ongoing_command.is_none())] - pub fn execute_stepper(&mut self, command: Command) -> Result { + pub fn execute_stepper(&mut self, command: Command) -> Result { let execute = self.dispatch_command(&command); self.ongoing_command = Some(command); execute } #[debug_requires(self.ongoing_command.is_none())] - fn dispatch_command(&mut self, command: &Command) -> Result { + fn dispatch_command(&mut self, command: &Command) -> Result { Ok(match command { Command::Autoroute(selection, options) => { let mut ratlines = self.autorouter.selected_ratlines(selection); @@ -134,19 +134,19 @@ impl Invoker { }); } - CommandStepper::Autoroute(self.autorouter.autoroute_ratlines(ratlines, *options)?) + ExecutionStepper::Autoroute(self.autorouter.autoroute_ratlines(ratlines, *options)?) } Command::PlaceVia(weight) => { - CommandStepper::PlaceVia(self.autorouter.place_via(*weight)?) + ExecutionStepper::PlaceVia(self.autorouter.place_via(*weight)?) } Command::RemoveBands(selection) => { - CommandStepper::RemoveBands(self.autorouter.remove_bands(selection)?) + ExecutionStepper::RemoveBands(self.autorouter.remove_bands(selection)?) } - Command::CompareDetours(selection, options) => CommandStepper::CompareDetours( + Command::CompareDetours(selection, options) => ExecutionStepper::CompareDetours( self.autorouter.compare_detours(selection, *options)?, ), Command::MeasureLength(selection) => { - CommandStepper::MeasureLength(self.autorouter.measure_length(selection)?) + ExecutionStepper::MeasureLength(self.autorouter.measure_length(selection)?) } }) } diff --git a/src/autorouter/measure_length.rs b/src/autorouter/measure_length.rs index 11b0991..f38c2ac 100644 --- a/src/autorouter/measure_length.rs +++ b/src/autorouter/measure_length.rs @@ -12,12 +12,12 @@ use super::{ Autorouter, AutorouterError, }; -pub struct MeasureLengthCommandStepper { +pub struct MeasureLengthExecutionStepper { selection: BandSelection, maybe_length: Option, } -impl MeasureLengthCommandStepper { +impl MeasureLengthExecutionStepper { pub fn new(selection: &BandSelection) -> Result { Ok(Self { selection: selection.clone(), @@ -51,25 +51,25 @@ impl MeasureLengthCommandStepper { } } -impl GetMaybeNavmesh for MeasureLengthCommandStepper { +impl GetMaybeNavmesh for MeasureLengthExecutionStepper { fn maybe_navmesh(&self) -> Option<&Navmesh> { None } } -impl GetMaybeTrace for MeasureLengthCommandStepper { +impl GetMaybeTrace for MeasureLengthExecutionStepper { fn maybe_trace(&self) -> Option<&TraceStepper> { None } } -impl GetGhosts for MeasureLengthCommandStepper { +impl GetGhosts for MeasureLengthExecutionStepper { fn ghosts(&self) -> &[PrimitiveShape] { &[] } } -impl GetObstacles for MeasureLengthCommandStepper { +impl GetObstacles for MeasureLengthExecutionStepper { fn obstacles(&self) -> &[PrimitiveIndex] { &[] } diff --git a/src/autorouter/place_via.rs b/src/autorouter/place_via.rs index bacb254..b81a92d 100644 --- a/src/autorouter/place_via.rs +++ b/src/autorouter/place_via.rs @@ -12,12 +12,12 @@ use super::{ }; #[derive(Debug)] -pub struct PlaceViaCommandStepper { +pub struct PlaceViaExecutionStepper { weight: ViaWeight, done: bool, } -impl PlaceViaCommandStepper { +impl PlaceViaExecutionStepper { pub fn new(weight: ViaWeight) -> Result { Ok(Self { weight, @@ -39,25 +39,25 @@ impl PlaceViaCommandStepper { } } -impl GetMaybeNavmesh for PlaceViaCommandStepper { +impl GetMaybeNavmesh for PlaceViaExecutionStepper { fn maybe_navmesh(&self) -> Option<&Navmesh> { None } } -impl GetMaybeTrace for PlaceViaCommandStepper { +impl GetMaybeTrace for PlaceViaExecutionStepper { fn maybe_trace(&self) -> Option<&TraceStepper> { None } } -impl GetGhosts for PlaceViaCommandStepper { +impl GetGhosts for PlaceViaExecutionStepper { fn ghosts(&self) -> &[PrimitiveShape] { &[] } } -impl GetObstacles for PlaceViaCommandStepper { +impl GetObstacles for PlaceViaExecutionStepper { fn obstacles(&self) -> &[PrimitiveIndex] { &[] } diff --git a/src/autorouter/remove_bands.rs b/src/autorouter/remove_bands.rs index cea80a9..3524c53 100644 --- a/src/autorouter/remove_bands.rs +++ b/src/autorouter/remove_bands.rs @@ -12,12 +12,12 @@ use super::{ }; #[derive(Debug)] -pub struct RemoveBandsCommandStepper { +pub struct RemoveBandsExecutionStepper { selection: BandSelection, done: bool, } -impl RemoveBandsCommandStepper { +impl RemoveBandsExecutionStepper { pub fn new(selection: &BandSelection) -> Result { Ok(Self { selection: selection.clone(), @@ -47,25 +47,25 @@ impl RemoveBandsCommandStepper { } } -impl GetMaybeNavmesh for RemoveBandsCommandStepper { +impl GetMaybeNavmesh for RemoveBandsExecutionStepper { fn maybe_navmesh(&self) -> Option<&Navmesh> { None } } -impl GetMaybeTrace for RemoveBandsCommandStepper { +impl GetMaybeTrace for RemoveBandsExecutionStepper { fn maybe_trace(&self) -> Option<&TraceStepper> { None } } -impl GetGhosts for RemoveBandsCommandStepper { +impl GetGhosts for RemoveBandsExecutionStepper { fn ghosts(&self) -> &[PrimitiveShape] { &[] } } -impl GetObstacles for RemoveBandsCommandStepper { +impl GetObstacles for RemoveBandsExecutionStepper { fn obstacles(&self) -> &[PrimitiveIndex] { &[] } diff --git a/src/bin/topola-egui/activity.rs b/src/bin/topola-egui/activity.rs index 10d4a4a..a231707 100644 --- a/src/bin/topola-egui/activity.rs +++ b/src/bin/topola-egui/activity.rs @@ -1,7 +1,7 @@ use thiserror::Error; use topola::{ autorouter::{ - command::CommandStepper, + command::ExecutionStepper, invoker::{ GetGhosts, GetMaybeNavmesh, GetMaybeTrace, GetObstacles, Invoker, InvokerError, InvokerStatus, @@ -15,18 +15,18 @@ use topola::{ step::Step, }; -#[derive(Error, Debug, Clone)] -pub enum ActivityError { - #[error(transparent)] - Invoker(#[from] InvokerError), -} - #[derive(Debug, Clone)] pub enum ActivityStatus { Running, Finished(String), } +#[derive(Error, Debug, Clone)] +pub enum ActivityError { + #[error(transparent)] + Invoker(#[from] InvokerError), +} + impl From for ActivityStatus { fn from(status: InvokerStatus) -> Self { match status { @@ -48,7 +48,7 @@ impl TryInto<()> for ActivityStatus { pub enum ActivityStepper { // There will be another variant for interactive activities here soon. (TODO) - Command(CommandStepper), + Execution(ExecutionStepper), } impl Step, ActivityStatus, ActivityError, ()> for ActivityStepper { @@ -57,7 +57,7 @@ impl Step, ActivityStatus, ActivityError, ()> for Acti invoker: &mut Invoker, ) -> Result { match self { - ActivityStepper::Command(execute) => Ok(execute.step(invoker)?.into()), + ActivityStepper::Execution(execute) => Ok(execute.step(invoker)?.into()), } } } @@ -66,7 +66,7 @@ impl GetMaybeNavmesh for ActivityStepper { /// Implemented manually instead of with `enum_dispatch` because it doesn't work across crates. fn maybe_navmesh(&self) -> Option<&Navmesh> { match self { - ActivityStepper::Command(execute) => execute.maybe_navmesh(), + ActivityStepper::Execution(execute) => execute.maybe_navmesh(), } } } @@ -75,7 +75,7 @@ impl GetMaybeTrace for ActivityStepper { /// Implemented manually instead of with `enum_dispatch` because it doesn't work across crates. fn maybe_trace(&self) -> Option<&TraceStepper> { match self { - ActivityStepper::Command(execute) => execute.maybe_trace(), + ActivityStepper::Execution(execute) => execute.maybe_trace(), } } } @@ -84,7 +84,7 @@ impl GetGhosts for ActivityStepper { /// Implemented manually instead of with `enum_dispatch` because it doesn't work across crates. fn ghosts(&self) -> &[PrimitiveShape] { match self { - ActivityStepper::Command(execute) => execute.ghosts(), + ActivityStepper::Execution(execute) => execute.ghosts(), } } } @@ -93,7 +93,7 @@ impl GetObstacles for ActivityStepper { /// Implemented manually instead of with `enum_dispatch` because it doesn't work across crates. fn obstacles(&self) -> &[PrimitiveIndex] { match self { - ActivityStepper::Command(execute) => execute.obstacles(), + ActivityStepper::Execution(execute) => execute.obstacles(), } } } @@ -104,9 +104,9 @@ pub struct ActivityWithStatus { } impl ActivityWithStatus { - pub fn new_execute(execute: CommandStepper) -> ActivityWithStatus { + pub fn new_execute(execute: ExecutionStepper) -> ActivityWithStatus { Self { - activity: ActivityStepper::Command(execute), + activity: ActivityStepper::Execution(execute), maybe_status: None, } } diff --git a/src/bin/topola-egui/routing.rs b/src/bin/topola-egui/routing.rs new file mode 100644 index 0000000..b0e1dcc --- /dev/null +++ b/src/bin/topola-egui/routing.rs @@ -0,0 +1,4 @@ +pub struct RouteInteractionStepper { + route: RouteStepper, + options: RouterOptions, +}