# dynpatch-watcher
File watching and live config reloading for dynpatch.
## Features
- **File watching**: Monitor files for changes using `notify`
- **Config hot-reloading**: Automatically reload configuration files
- **Multiple formats**: Support for JSON, TOML, and YAML
- **Lock-free updates**: Use `arc-swap` for thread-safe config access
- **Validation hooks**: Validate configs before applying
## Example
```rust
use dynpatch_watcher::config::{HotConfig, watch};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize)]
struct AppConfig {
max_connections: usize,
log_level: String,
}
impl HotConfig for AppConfig {}
fn main() {
let watcher = watch::<AppConfig, _>("config.toml").unwrap();
loop {
let config = watcher.get();
println!("Max connections: {}", config.max_connections);
std::thread::sleep(std::time::Duration::from_secs(1));
}
}
```
## Features
- `json` (default) - JSON format support
- `toml` (default) - TOML format support
- `yaml` (default) - YAML format support
## License
MIT - See LICENSE file for details