mirror of https://codeberg.org/topola/topola.git
chore: perform forgotten rename of `command.rs` to `execution.rs`
This commit is contained in:
parent
5f6045a758
commit
8b9d4074e4
|
|
@ -1,96 +0,0 @@
|
|||
use enum_dispatch::enum_dispatch;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{board::mesadata::AccessMesadata, layout::via::ViaWeight, stepper::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<M: AccessMesadata>(
|
||||
&mut self,
|
||||
invoker: &mut Invoker<M>,
|
||||
) -> Result<InvokerStatus, InvokerError> {
|
||||
Ok(match self {
|
||||
ExecutionStepper::Autoroute(autoroute) => {
|
||||
match autoroute.step(&mut invoker.autorouter)? {
|
||||
AutorouteStatus::Running => InvokerStatus::Running,
|
||||
AutorouteStatus::Routed(..) => InvokerStatus::Running,
|
||||
AutorouteStatus::Finished => {
|
||||
InvokerStatus::Finished("finished autorouting".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
ExecutionStepper::PlaceVia(place_via) => {
|
||||
place_via.doit(&mut invoker.autorouter)?;
|
||||
InvokerStatus::Finished("finished placing via".to_string())
|
||||
}
|
||||
ExecutionStepper::RemoveBands(remove_bands) => {
|
||||
remove_bands.doit(&mut invoker.autorouter)?;
|
||||
InvokerStatus::Finished("finished removing bands".to_string())
|
||||
}
|
||||
ExecutionStepper::CompareDetours(compare_detours) => {
|
||||
match compare_detours.step(&mut invoker.autorouter)? {
|
||||
CompareDetoursStatus::Running => InvokerStatus::Running,
|
||||
CompareDetoursStatus::Finished(total_length1, total_length2) => {
|
||||
InvokerStatus::Finished(format!(
|
||||
"total detour lengths are {} and {}",
|
||||
total_length1, total_length2
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
ExecutionStepper::MeasureLength(measure_length) => {
|
||||
let length = measure_length.doit(&mut invoker.autorouter)?;
|
||||
InvokerStatus::Finished(format!("Total length of selected bands: {}", length))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<M: AccessMesadata> Step<Invoker<M>, InvokerStatus, InvokerError, ()> for ExecutionStepper {
|
||||
fn step(&mut self, invoker: &mut Invoker<M>) -> Result<InvokerStatus, InvokerError> {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
use enum_dispatch::enum_dispatch;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{board::mesadata::AccessMesadata, layout::via::ViaWeight, step::Step};
|
||||
use crate::{board::mesadata::AccessMesadata, layout::via::ViaWeight, stepper::Step};
|
||||
|
||||
use super::{
|
||||
autoroute::{AutorouteExecutionStepper, AutorouteStatus},
|
||||
|
|
@ -39,47 +39,40 @@ impl ExecutionStepper {
|
|||
&mut self,
|
||||
invoker: &mut Invoker<M>,
|
||||
) -> Result<InvokerStatus, InvokerError> {
|
||||
match self {
|
||||
Ok(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",
|
||||
))),
|
||||
AutorouteStatus::Running => InvokerStatus::Running,
|
||||
AutorouteStatus::Routed(..) => InvokerStatus::Running,
|
||||
AutorouteStatus::Finished => {
|
||||
InvokerStatus::Finished("finished autorouting".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
ExecutionStepper::PlaceVia(place_via) => {
|
||||
place_via.doit(&mut invoker.autorouter)?;
|
||||
Ok(InvokerStatus::Finished(String::from(
|
||||
"finished placing via",
|
||||
)))
|
||||
InvokerStatus::Finished("finished placing via".to_string())
|
||||
}
|
||||
ExecutionStepper::RemoveBands(remove_bands) => {
|
||||
remove_bands.doit(&mut invoker.autorouter)?;
|
||||
Ok(InvokerStatus::Finished(String::from(
|
||||
"finished removing bands",
|
||||
)))
|
||||
InvokerStatus::Finished("finished removing bands".to_string())
|
||||
}
|
||||
ExecutionStepper::CompareDetours(compare_detours) => {
|
||||
match compare_detours.step(&mut invoker.autorouter)? {
|
||||
CompareDetoursStatus::Running => Ok(InvokerStatus::Running),
|
||||
CompareDetoursStatus::Running => InvokerStatus::Running,
|
||||
CompareDetoursStatus::Finished(total_length1, total_length2) => {
|
||||
Ok(InvokerStatus::Finished(String::from(format!(
|
||||
InvokerStatus::Finished(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
|
||||
)))
|
||||
}
|
||||
InvokerStatus::Finished(format!("Total length of selected bands: {}", length))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::autorouter::command::Command;
|
||||
use crate::autorouter::execution::Command;
|
||||
|
||||
#[derive(Error, Debug, Clone)]
|
||||
pub enum HistoryError {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ use crate::{
|
|||
|
||||
use super::{
|
||||
autoroute::AutorouteExecutionStepper,
|
||||
command::{Command, ExecutionStepper},
|
||||
compare_detours::CompareDetoursExecutionStepper,
|
||||
execution::{Command, ExecutionStepper},
|
||||
history::{History, HistoryError},
|
||||
measure_length::MeasureLengthExecutionStepper,
|
||||
place_via::PlaceViaExecutionStepper,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
pub mod autoroute;
|
||||
mod autorouter;
|
||||
pub mod command;
|
||||
pub mod compare_detours;
|
||||
pub mod execution;
|
||||
pub mod history;
|
||||
pub mod invoker;
|
||||
pub mod measure_length;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use thiserror::Error;
|
||||
use topola::{
|
||||
autorouter::{
|
||||
command::ExecutionStepper,
|
||||
execution::ExecutionStepper,
|
||||
invoker::{
|
||||
GetGhosts, GetMaybeNavmesh, GetMaybeTrace, GetObstacles, Invoker, InvokerError,
|
||||
InvokerStatus,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
|
||||
use topola::{
|
||||
autorouter::{
|
||||
command::Command,
|
||||
execution::Command,
|
||||
history::History,
|
||||
invoker::{Invoker, InvokerError},
|
||||
AutorouterOptions,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use petgraph::{
|
|||
use rstar::{Envelope, AABB};
|
||||
use topola::{
|
||||
autorouter::{
|
||||
command::Command,
|
||||
execution::Command,
|
||||
invoker::{GetGhosts, GetMaybeNavmesh, GetMaybeTrace, GetObstacles, Invoker},
|
||||
},
|
||||
drawing::{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use clap::Parser;
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use topola::autorouter::command::Command;
|
||||
use topola::autorouter::execution::Command;
|
||||
use topola::autorouter::history::History;
|
||||
use topola::autorouter::invoker::Invoker;
|
||||
use topola::autorouter::selection::PinSelection;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use topola::{
|
||||
autorouter::{command::Command, invoker::InvokerError, AutorouterError},
|
||||
autorouter::{execution::Command, invoker::InvokerError, AutorouterError},
|
||||
board::mesadata::AccessMesadata,
|
||||
layout::via::ViaWeight,
|
||||
math::Circle,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use topola::{
|
||||
autorouter::{
|
||||
command::Command,
|
||||
execution::Command,
|
||||
invoker::{Invoker, InvokerError},
|
||||
AutorouterError,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue