hmr
Hot Module Reloading (HMR) for Rust.
Examples
use Module;
use write;
use sleep;
use Duration;
const PATH: &'static str = "test/foo.txt";
static FOO: Module = new;
assert_eq!;
modify_file;
assert_eq!;
modify_file;
assert_eq!;
Hot Module Reloading (HMR) for Rust.
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());