pub struct Config {
pub modules_path: Option<PathBuf>,
pub max_call_depth: u32,
pub max_module_repeat: u32,
pub default_timeout_ms: u64,
pub global_timeout_ms: u64,
pub enable_tracing: bool,
pub enable_metrics: bool,
pub settings: HashMap<String, Value>,
pub yaml_path: Option<PathBuf>,
}Fields§
§modules_path: Option<PathBuf>§max_call_depth: u32§max_module_repeat: u32§default_timeout_ms: u64§global_timeout_ms: u64§enable_tracing: bool§enable_metrics: bool§settings: HashMap<String, Value>§yaml_path: Option<PathBuf>Implementations§
Source§impl Config
impl Config
Sourcepub fn from_json_file(path: &Path) -> Result<Config, ModuleError>
pub fn from_json_file(path: &Path) -> Result<Config, ModuleError>
Load config from a JSON file, apply env overrides, and validate.
Sourcepub fn from_yaml_file(path: &Path) -> Result<Config, ModuleError>
pub fn from_yaml_file(path: &Path) -> Result<Config, ModuleError>
Load config from a YAML file, apply env overrides, and validate.
Sourcepub fn load(path: &Path) -> Result<Config, ModuleError>
pub fn load(path: &Path) -> Result<Config, ModuleError>
Auto-detect format by file extension and load.
Sourcepub fn validate(&self) -> Result<(), ModuleError>
pub fn validate(&self) -> Result<(), ModuleError>
Validate config constraints. Returns an error listing all violations.
Sourcepub fn from_defaults() -> Config
pub fn from_defaults() -> Config
Build config from defaults, applying env var overrides.
Sourcepub fn get(&self, key: &str) -> Option<Value>
pub fn get(&self, key: &str) -> Option<Value>
Get a config value by dot-path key.
First checks typed fields (e.g. “executor.max_call_depth”), then falls
back to the settings HashMap for arbitrary nested config.
Sourcepub fn set(&mut self, key: &str, value: Value)
pub fn set(&mut self, key: &str, value: Value)
Set a config value by dot-path key.
Attempts to set typed fields first, then falls back to the settings HashMap.
Sourcepub fn reload(&mut self) -> Result<(), ModuleError>
pub fn reload(&mut self) -> Result<(), ModuleError>
Reload config from the stored yaml_path. Returns error if no path stored.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Config
impl Serialize for Config
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more