pub struct HotReloadWatcher { /* private fields */ }Expand description
Tracks file modification timestamps and detects changes.
Uses a HashMap<String, u64> for timestamps (simulated or real).
Implementations§
Source§impl HotReloadWatcher
impl HotReloadWatcher
pub fn new() -> Self
Sourcepub fn watch(&mut self, path: impl Into<String>, timestamp: u64)
pub fn watch(&mut self, path: impl Into<String>, timestamp: u64)
Register a file with its current timestamp.
Sourcepub fn snapshot_source(
&mut self,
path: impl Into<String>,
source: impl Into<String>,
)
pub fn snapshot_source( &mut self, path: impl Into<String>, source: impl Into<String>, )
Update the watcher’s snapshot of a file’s source content.
Sourcepub fn set_timestamp(&mut self, path: &str, ts: u64)
pub fn set_timestamp(&mut self, path: &str, ts: u64)
Set timestamp for a path (simulates an mtime update).
Sourcepub fn check_changes(
&self,
current_timestamps: &HashMap<String, u64>,
) -> Vec<String>
pub fn check_changes( &self, current_timestamps: &HashMap<String, u64>, ) -> Vec<String>
Check which files have changed since last snapshot. Returns paths whose current timestamp differs from registered.
Sourcepub fn reload_changed(
&mut self,
current_timestamps: &HashMap<String, u64>,
registry: &mut ModuleRegistry,
vm: &mut Vm,
) -> Vec<(String, Result<(), String>)>
pub fn reload_changed( &mut self, current_timestamps: &HashMap<String, u64>, registry: &mut ModuleRegistry, vm: &mut Vm, ) -> Vec<(String, Result<(), String>)>
Reload any changed modules detected by comparing the given current timestamps.
pub fn watched_paths(&self) -> Vec<String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HotReloadWatcher
impl RefUnwindSafe for HotReloadWatcher
impl Send for HotReloadWatcher
impl Sync for HotReloadWatcher
impl Unpin for HotReloadWatcher
impl UnsafeUnpin for HotReloadWatcher
impl UnwindSafe for HotReloadWatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.