#module #hot #write

hmr

Hot Module Reploading for Rust

7 releases

Uses new Rust 2024

0.2.5 Sep 20, 2025
0.2.4 Sep 20, 2025
0.2.3 Feb 22, 2025
0.2.2 Jan 12, 2025
0.1.0 Dec 15, 2024

#32 in #write

Download history 206/week @ 2025-10-15 212/week @ 2025-10-22 58/week @ 2025-10-29 274/week @ 2025-11-05 217/week @ 2025-11-12 144/week @ 2025-11-19 345/week @ 2025-11-26 1016/week @ 2025-12-03 664/week @ 2025-12-10 871/week @ 2025-12-17 1518/week @ 2025-12-24 1407/week @ 2025-12-31 805/week @ 2026-01-07 609/week @ 2026-01-14 517/week @ 2026-01-21 529/week @ 2026-01-28

2,643 downloads per month
Used in 4 crates (via stak-module)

MIT license

7KB
72 lines

hmr

GitHub Action Crate License

Hot Module Reloading (HMR) for Rust.

Examples

use hmr::Module;
use std::fs::write;
use std::thread::sleep;
use std::time::Duration;

const PATH: &'static str = "test/foo.txt";
static FOO: Module = Module::new(PATH);

fn modify_file(content: &str) {
    write(PATH, content).unwrap();
    sleep(Duration::from_millis(100));
}

assert_eq!(&*FOO.load(), "foo\n".as_bytes());

modify_file("Hello, HMR!\n");
assert_eq!(&*FOO.load(), "Hello, HMR!\n".as_bytes());

modify_file("foo\n");
assert_eq!(&*FOO.load(), "foo\n".as_bytes());

License

MIT

Dependencies

~0.5–11MB
~64K SLoC