pub struct ConfigWatcher { /* private fields */ }Expand description
Watches the config file and broadcasts validated changes — the corner team that keeps the fighter’s strategy sharp without stopping the bout.
Implementations§
Source§impl ConfigWatcher
impl ConfigWatcher
Sourcepub fn new(config_path: PathBuf, initial_config: PunchConfig) -> Self
pub fn new(config_path: PathBuf, initial_config: PunchConfig) -> Self
Create a new ConfigWatcher ready to observe the corner team’s playbook.
Sourcepub fn subscribe(&self) -> Receiver<PunchConfig>
pub fn subscribe(&self) -> Receiver<PunchConfig>
Subscribe to config changes — get a ringside seat for every strategy adjustment.
Sourcepub fn current(&self) -> PunchConfig
pub fn current(&self) -> PunchConfig
Get a snapshot of the current config — check what game plan the fighter is using right now.
Sourcepub async fn start_watching(&self) -> PunchResult<()>
pub async fn start_watching(&self) -> PunchResult<()>
Start watching the config file for changes — the corner team takes their position.
Spawns a background task that monitors the config file using filesystem events and applies validated changes automatically.
Sourcepub fn apply_change(
&self,
new_config: PunchConfig,
) -> Result<ConfigChangeSet, ConfigValidationError>
pub fn apply_change( &self, new_config: PunchConfig, ) -> Result<ConfigChangeSet, ConfigValidationError>
Validate and apply a new config programmatically — a direct corner team call.
Returns the set of changes if the config is valid, or a validation error if the new config fails checks.