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 new() -> EngineConfig
pub fn new() -> EngineConfig
Create a new engine config with default values.
Sourcepub fn from_yaml_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
pub fn from_yaml_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
Load config from a YAML file.
Sourcepub fn from_json_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
pub fn from_json_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
Load config from a JSON file.
Sourcepub fn from_toml_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
pub fn from_toml_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
Load config from a TOML file.
Sourcepub fn from_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
pub fn from_file(path: impl Into<PathBuf>) -> Result<EngineConfig, Error>
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) -> EngineConfig
pub fn with_max_devices(self, max: usize) -> EngineConfig
Set maximum devices.
Sourcepub fn with_max_points(self, max: usize) -> EngineConfig
pub fn with_max_points(self, max: usize) -> EngineConfig
Set maximum data points.
Sourcepub fn with_tick_interval(self, interval: Duration) -> EngineConfig
pub fn with_tick_interval(self, interval: Duration) -> EngineConfig
Set tick interval.
Sourcepub fn with_workers(self, workers: usize) -> EngineConfig
pub fn with_workers(self, workers: usize) -> EngineConfig
Set number of worker threads.
Sourcepub fn with_log_level(self, level: impl Into<String>) -> EngineConfig
pub fn with_log_level(self, level: impl Into<String>) -> EngineConfig
Set log level.
Sourcepub fn with_metrics(self, enable: bool) -> EngineConfig
pub fn with_metrics(self, enable: bool) -> EngineConfig
Enable or disable metrics.
Sourcepub fn with_protocol(
self,
name: impl Into<String>,
config: ProtocolConfig,
) -> EngineConfig
pub fn with_protocol( self, name: impl Into<String>, config: ProtocolConfig, ) -> EngineConfig
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<EngineConfig>
pub fn env_overrides() -> EnvOverrides<EngineConfig>
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 moreSource§impl Debug for EngineConfig
impl Debug for EngineConfig
Source§impl Default for EngineConfig
impl Default for EngineConfig
Source§fn default() -> EngineConfig
fn default() -> EngineConfig
Source§impl<'de> Deserialize<'de> for EngineConfig
impl<'de> Deserialize<'de> for EngineConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EngineConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EngineConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl EnvConfigurable for EngineConfig
impl EnvConfigurable for EngineConfig
Source§fn env_overrides() -> EnvOverrides<EngineConfig>
fn env_overrides() -> EnvOverrides<EngineConfig>
Source§impl Serialize for EngineConfig
impl Serialize for EngineConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Validatable for EngineConfig
impl Validatable for EngineConfig
Auto Trait Implementations§
impl Freeze for EngineConfig
impl RefUnwindSafe for EngineConfig
impl Send for EngineConfig
impl Sync for EngineConfig
impl Unpin for EngineConfig
impl UnsafeUnpin for EngineConfig
impl UnwindSafe for EngineConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more