pub struct EngineConfig {
pub name: String,
pub max_devices: usize,
pub max_points: usize,
pub tick_interval_ms: u64,
pub workers: usize,
pub enable_metrics: bool,
pub metrics_interval_secs: u64,
pub log_level: String,
pub protocols: HashMap<String, ProtocolConfig>,
}Expand description
Main engine configuration.
Fields§
§name: StringEngine name.
max_devices: usizeMaximum number of devices.
max_points: usizeMaximum number of data points.
tick_interval_ms: u64Tick interval in milliseconds.
workers: usizeNumber of worker threads.
enable_metrics: boolEnable metrics collection.
metrics_interval_secs: u64Metrics export interval in seconds.
log_level: StringLog level.
protocols: HashMap<String, ProtocolConfig>Protocol configurations.
Implementations§
Source§impl EngineConfig
impl EngineConfig
Sourcepub fn from_yaml_file(path: impl Into<PathBuf>) -> Result<Self>
pub fn from_yaml_file(path: impl Into<PathBuf>) -> Result<Self>
Load config from a YAML file.
Sourcepub fn from_json_file(path: impl Into<PathBuf>) -> Result<Self>
pub fn from_json_file(path: impl Into<PathBuf>) -> Result<Self>
Load config from a JSON file.
Sourcepub fn from_toml_file(path: impl Into<PathBuf>) -> Result<Self>
pub fn from_toml_file(path: impl Into<PathBuf>) -> Result<Self>
Load config from a TOML file.
Sourcepub fn from_file(path: impl Into<PathBuf>) -> Result<Self>
pub fn from_file(path: impl Into<PathBuf>) -> Result<Self>
Load config from any supported file (auto-detect format).
Sourcepub fn tick_interval(&self) -> Duration
pub fn tick_interval(&self) -> Duration
Get tick interval as Duration.
Sourcepub fn with_max_devices(self, max: usize) -> Self
pub fn with_max_devices(self, max: usize) -> Self
Set maximum devices.
Sourcepub fn with_max_points(self, max: usize) -> Self
pub fn with_max_points(self, max: usize) -> Self
Set maximum data points.
Sourcepub fn with_tick_interval(self, interval: Duration) -> Self
pub fn with_tick_interval(self, interval: Duration) -> Self
Set tick interval.
Sourcepub fn with_workers(self, workers: usize) -> Self
pub fn with_workers(self, workers: usize) -> Self
Set number of worker threads.
Sourcepub fn with_log_level(self, level: impl Into<String>) -> Self
pub fn with_log_level(self, level: impl Into<String>) -> Self
Set log level.
Sourcepub fn with_metrics(self, enable: bool) -> Self
pub fn with_metrics(self, enable: bool) -> Self
Enable or disable metrics.
Sourcepub fn with_protocol(
self,
name: impl Into<String>,
config: ProtocolConfig,
) -> Self
pub fn with_protocol( self, name: impl Into<String>, config: ProtocolConfig, ) -> Self
Add protocol config.
Sourcepub fn apply_env_overrides(&mut self) -> EnvApplyResult
pub fn apply_env_overrides(&mut self) -> EnvApplyResult
Apply environment variable overrides.
Reads environment variables with the TRAP_SIM_ prefix and applies
matching values to the configuration.
Sourcepub fn env_overrides() -> EnvOverrides<Self>
pub fn env_overrides() -> EnvOverrides<Self>
Create environment overrides configuration.
Trait Implementations§
Source§impl Clone for EngineConfig
impl Clone for EngineConfig
Source§fn clone(&self) -> EngineConfig
fn clone(&self) -> EngineConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more