forked from NationTech/harmony
chore: Move ADR helper files into folders with their corresponding ADR number
This commit is contained in:
34
adr/003-abstractions/topology2/src/main_v1.rs
Normal file
34
adr/003-abstractions/topology2/src/main_v1.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
fn main() {}
|
||||
|
||||
trait Topology {}
|
||||
|
||||
struct DummyTopology {}
|
||||
|
||||
impl Topology for DummyTopology {}
|
||||
|
||||
impl Topology for LampTopology {}
|
||||
|
||||
struct LampTopology {}
|
||||
|
||||
struct Maestro {
|
||||
topology: Box<dyn Topology>,
|
||||
}
|
||||
|
||||
trait Score {
|
||||
type Topology: Topology;
|
||||
fn execute(&self, topology: &Self::Topology);
|
||||
}
|
||||
|
||||
struct K8sScore {}
|
||||
impl Score for K8sScore {
|
||||
type Topology = LampTopology;
|
||||
fn execute(&self, topology: &Box<dyn Self::Topology>) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Maestro {
|
||||
pub fn execute<T: Topology>(&self, score: Box<dyn Score<Topology = T>>) {
|
||||
score.execute(&self.topology);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user