Move manager into it's own project

This commit is contained in:
Michael Mikovsky
2025-12-20 22:39:56 -07:00
parent 338eb93bfc
commit 1ea26641d6
31 changed files with 234 additions and 1093 deletions
+1 -60
View File
@@ -1,25 +1,4 @@
use std::{collections::HashMap, fmt::Debug};
// use bincode::{Decode, Encode};
// use serde::{Deserialize, Serialize};
// use bincode::{Decode, Encode};
use crate::{ModuleError, ModuleRuntime};
// /// Payload config that is instantiated
// #[derive(Serialize, Deserialize)]
// pub struct Config {
// pub id: String,
// pub key: String,
// pub components: Vec<String>,
// }
pub struct PayloadConfig {
pub id: &'static str,
pub components: Vec<NamedComponent>,
pub runtime_config: Vec<RuntimeConfig>,
}
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct RuntimeConfig {
@@ -27,41 +6,3 @@ pub struct RuntimeConfig {
pub name: String,
pub config: HashMap<String, String>,
}
#[derive(Clone)]
pub struct NamedComponent {
pub name: &'static str,
// + Sync + Sync + Sync + Sync + Sync + Sync + Sync + Sync
pub get_interface: &'static (dyn Fn() -> Option<&'static (dyn InterfaceWrapper + Sync)> + Sync),
pub start_runtime: &'static (
dyn Fn(&'static RuntimeConfig) -> Result<Box<dyn ModuleRuntime>, ModuleError>
+ Sync
),
}
impl Debug for NamedComponent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("NamedComponent")
.field("name", &self.name)
// .field("get_interface", &self.get_interface)
// .field("start_runtime", &self.start_runtime)
.finish()
}
}
/// Trait that wraps the get_interface<T>() function inside of components
pub trait InterfaceWrapper: Send + Sync {
fn get_interface<T: 'static>(&self) -> Option<T>
where
Self: Sized;
}
// impl<T: 'static> InterfaceWrapper for T {
// default fn get_interface<T>() -> Option<T>
// where
// Self: Sized,
// {
// None
// }
// }