mirror of https://codeberg.org/topola/topola.git
chore(autorouter): let ExecutionStepper::step_catch_err take Autorouter as context
This commit is contained in:
parent
8559734336
commit
4f40c26bac
|
|
@ -11,7 +11,7 @@ use super::{
|
||||||
place_via::PlaceViaExecutionStepper,
|
place_via::PlaceViaExecutionStepper,
|
||||||
remove_bands::RemoveBandsExecutionStepper,
|
remove_bands::RemoveBandsExecutionStepper,
|
||||||
selection::{BandSelection, PinSelection},
|
selection::{BandSelection, PinSelection},
|
||||||
AutorouterOptions,
|
Autorouter, AutorouterOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
type Type = PinSelection;
|
type Type = PinSelection;
|
||||||
|
|
@ -37,28 +37,26 @@ pub enum ExecutionStepper {
|
||||||
impl ExecutionStepper {
|
impl ExecutionStepper {
|
||||||
fn step_catch_err<M: AccessMesadata>(
|
fn step_catch_err<M: AccessMesadata>(
|
||||||
&mut self,
|
&mut self,
|
||||||
invoker: &mut Invoker<M>,
|
autorouter: &mut Autorouter<M>,
|
||||||
) -> Result<InvokerStatus, InvokerError> {
|
) -> Result<InvokerStatus, InvokerError> {
|
||||||
Ok(match self {
|
Ok(match self {
|
||||||
ExecutionStepper::Autoroute(autoroute) => {
|
ExecutionStepper::Autoroute(autoroute) => match autoroute.step(autorouter)? {
|
||||||
match autoroute.step(&mut invoker.autorouter)? {
|
|
||||||
AutorouteStatus::Running => InvokerStatus::Running,
|
AutorouteStatus::Running => InvokerStatus::Running,
|
||||||
AutorouteStatus::Routed(..) => InvokerStatus::Running,
|
AutorouteStatus::Routed(..) => InvokerStatus::Running,
|
||||||
AutorouteStatus::Finished => {
|
AutorouteStatus::Finished => {
|
||||||
InvokerStatus::Finished("finished autorouting".to_string())
|
InvokerStatus::Finished("finished autorouting".to_string())
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
|
||||||
ExecutionStepper::PlaceVia(place_via) => {
|
ExecutionStepper::PlaceVia(place_via) => {
|
||||||
place_via.doit(&mut invoker.autorouter)?;
|
place_via.doit(autorouter)?;
|
||||||
InvokerStatus::Finished("finished placing via".to_string())
|
InvokerStatus::Finished("finished placing via".to_string())
|
||||||
}
|
}
|
||||||
ExecutionStepper::RemoveBands(remove_bands) => {
|
ExecutionStepper::RemoveBands(remove_bands) => {
|
||||||
remove_bands.doit(&mut invoker.autorouter)?;
|
remove_bands.doit(autorouter)?;
|
||||||
InvokerStatus::Finished("finished removing bands".to_string())
|
InvokerStatus::Finished("finished removing bands".to_string())
|
||||||
}
|
}
|
||||||
ExecutionStepper::CompareDetours(compare_detours) => {
|
ExecutionStepper::CompareDetours(compare_detours) => {
|
||||||
match compare_detours.step(&mut invoker.autorouter)? {
|
match compare_detours.step(autorouter)? {
|
||||||
CompareDetoursStatus::Running => InvokerStatus::Running,
|
CompareDetoursStatus::Running => InvokerStatus::Running,
|
||||||
CompareDetoursStatus::Finished(total_length1, total_length2) => {
|
CompareDetoursStatus::Finished(total_length1, total_length2) => {
|
||||||
InvokerStatus::Finished(format!(
|
InvokerStatus::Finished(format!(
|
||||||
|
|
@ -69,7 +67,7 @@ impl ExecutionStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExecutionStepper::MeasureLength(measure_length) => {
|
ExecutionStepper::MeasureLength(measure_length) => {
|
||||||
let length = measure_length.doit(&mut invoker.autorouter)?;
|
let length = measure_length.doit(autorouter)?;
|
||||||
InvokerStatus::Finished(format!("Total length of selected bands: {}", length))
|
InvokerStatus::Finished(format!("Total length of selected bands: {}", length))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -78,7 +76,7 @@ impl ExecutionStepper {
|
||||||
|
|
||||||
impl<M: AccessMesadata> Step<Invoker<M>, InvokerStatus, InvokerError, ()> for ExecutionStepper {
|
impl<M: AccessMesadata> Step<Invoker<M>, InvokerStatus, InvokerError, ()> for ExecutionStepper {
|
||||||
fn step(&mut self, invoker: &mut Invoker<M>) -> Result<InvokerStatus, InvokerError> {
|
fn step(&mut self, invoker: &mut Invoker<M>) -> Result<InvokerStatus, InvokerError> {
|
||||||
match self.step_catch_err(invoker) {
|
match self.step_catch_err(&mut invoker.autorouter) {
|
||||||
Ok(InvokerStatus::Running) => Ok(InvokerStatus::Running),
|
Ok(InvokerStatus::Running) => Ok(InvokerStatus::Running),
|
||||||
Ok(InvokerStatus::Finished(msg)) => {
|
Ok(InvokerStatus::Finished(msg)) => {
|
||||||
if let Some(command) = invoker.ongoing_command.take() {
|
if let Some(command) = invoker.ongoing_command.take() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue