hmr

Crates.iohmr
lib.rshmr
version0.2.5
created_at2024-12-15 11:23:19.149105+00
updated_at2025-09-20 04:27:47.626314+00
descriptionHot Module Reploading for Rust
homepage
repositoryhttps://github.com/raviqqe/hmr
max_upload_size
id1484071
size16,726
Yota Toyama (raviqqe)

documentation

README

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

Commit count: 23

cargo fmt