feat: TUI does not require Topology to implement Debug anymore
This commit is contained in:
@@ -67,10 +67,10 @@ enum HarmonyTuiEvent<T: Topology> {
|
||||
LaunchScore(Box<dyn Score<T>>),
|
||||
}
|
||||
|
||||
impl <T: Topology> std::fmt::Display for HarmonyTuiEvent<T> {
|
||||
impl<T: Topology> std::fmt::Display for HarmonyTuiEvent<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let output = match self {
|
||||
HarmonyTuiEvent::LaunchScore(score) => format!("LaunchScore({})",score.name()),
|
||||
HarmonyTuiEvent::LaunchScore(score) => format!("LaunchScore({})", score.name()),
|
||||
};
|
||||
|
||||
f.write_str(&output)
|
||||
|
||||
@@ -19,13 +19,21 @@ enum ExecutionState {
|
||||
CANCELED,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Execution<T: Topology> {
|
||||
state: ExecutionState,
|
||||
score: Box<dyn Score<T>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
impl<T: Topology> std::fmt::Display for Execution<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_fmt(format_args!(
|
||||
"Execution of {} status {:?}",
|
||||
self.score.name(),
|
||||
self.state
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct ScoreListWidget<T: Topology> {
|
||||
list_state: Arc<RwLock<ListState>>,
|
||||
scores: Vec<Box<dyn Score<T>>>,
|
||||
@@ -34,7 +42,7 @@ pub(crate) struct ScoreListWidget<T: Topology> {
|
||||
sender: mpsc::Sender<HarmonyTuiEvent<T>>,
|
||||
}
|
||||
|
||||
impl<T: Topology + std::fmt::Debug> ScoreListWidget<T> {
|
||||
impl<T: Topology> ScoreListWidget<T> {
|
||||
pub(crate) fn new(
|
||||
scores: Vec<Box<dyn Score<T>>>,
|
||||
sender: mpsc::Sender<HarmonyTuiEvent<T>>,
|
||||
@@ -99,7 +107,7 @@ impl<T: Topology + std::fmt::Debug> ScoreListWidget<T> {
|
||||
match confirm {
|
||||
true => {
|
||||
execution.state = ExecutionState::RUNNING;
|
||||
info!("Launch execution {:?}", execution);
|
||||
info!("Launch execution {execution}");
|
||||
self.sender
|
||||
.send(HarmonyTuiEvent::LaunchScore(execution.score.clone_box()))
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user