| Crates.io | hotreload |
| lib.rs | hotreload |
| version | 0.3.1 |
| created_at | 2024-01-16 14:15:34.057925+00 |
| updated_at | 2025-08-20 17:07:00.645625+00 |
| description | A simple crate to hotreload toml config files |
| homepage | |
| repository | https://github.com/AmionSky/hotreload |
| max_upload_size | |
| id | 1101616 |
| size | 30,009 |
A simple crate to hotreload toml config files.
use hotreload::{Hotreload, Apply};
#[derive(Default)]
struct Config {
value: Mutex<i32>
}
#[derive(serde::Deserialize)]
struct Data {
value: i32
}
impl Apply<Data> for Config {
fn apply(&self, data: Data) -> hotreload::ApplyResult {
*self.value.lock().unwrap() = data.value;
Ok(())
}
}
fn example() -> Result<(), hotreload::Error> {
let watcher = Hotreload::<Config, Data>::new("my-config.toml")?;
let config: Arc<Config> = watcher.config().clone()
}
Licensed under either of
at your option.