stak_module/
hot_reload.rsuse crate::{Guard, Module};
use core::ops::Deref;
pub struct HotReloadModule {
module: hmr::Module,
}
impl HotReloadModule {
pub const fn new(path: &'static str) -> Self {
Self {
module: hmr::Module::new(path),
}
}
}
impl Module<'static> for HotReloadModule {
type Guard = HotReloadGuard;
fn bytecode(&'static self) -> Self::Guard {
HotReloadGuard(self.module.load())
}
}
pub struct HotReloadGuard(hmr::Guard);
impl Deref for HotReloadGuard {
type Target = [u8];
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl Guard for HotReloadGuard {}