feat: Introduce Topology Trait for Compile-Time Safe Score Binding
Introduce the `Topology` trait to ensure that `Maestro` can compile-time safely bind compatible `Scores` and `Topologies`. This refactoring includes updating `HarmonyTuiEvent`, `ScoreListWidget`, and related structures to work with generic `Topology` types, enhancing type safety and modularity.
This commit is contained in:
@@ -2,7 +2,8 @@ use harmony::{
|
||||
data::Version,
|
||||
maestro::Maestro,
|
||||
modules::lamp::{LAMPConfig, LAMPScore},
|
||||
topology::Url,
|
||||
score::Score,
|
||||
topology::{HAClusterTopology, Topology, Url},
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -17,8 +18,12 @@ async fn main() {
|
||||
},
|
||||
};
|
||||
|
||||
Maestro::load_from_env()
|
||||
Maestro::<HAClusterTopology>::load_from_env()
|
||||
.interpret(Box::new(lamp_stack))
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn clone_score<T: Topology, S: Score<T> + Clone + 'static>(score: S) -> Box<S> {
|
||||
Box::new(score.clone())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user