pub struct HmrContext {
modules: Arc<Mutex<HashMap<String, HmrUpdate>>>,
last_rebuild: Arc<Mutex<Option<Instant>>>,
project_root: PathBuf,
}
Expand description
HMR context manager
Fields§
§modules: Arc<Mutex<HashMap<String, HmrUpdate>>>
Modified modules
last_rebuild: Arc<Mutex<Option<Instant>>>
Last full rebuild time
project_root: PathBuf
Project root directory
Implementations§
Source§impl HmrContext
impl HmrContext
Sourcepub fn record_file_change(&self, path: &Path) -> Option<String>
pub fn record_file_change(&self, path: &Path) -> Option<String>
Record a file change
Sourcepub fn mark_modules_updated(&self)
pub fn mark_modules_updated(&self)
Mark all modules as updated
Sourcepub fn needs_update(&self) -> bool
pub fn needs_update(&self) -> bool
Check if any modules need updating
Sourcepub fn get_pending_updates(&self) -> Vec<String>
pub fn get_pending_updates(&self) -> Vec<String>
Get pending module updates
Sourcepub fn record_rebuild(&self)
pub fn record_rebuild(&self)
Record a full rebuild
Sourcepub fn should_rebuild(&self, debounce_time: Duration) -> bool
pub fn should_rebuild(&self, debounce_time: Duration) -> bool
Check if a rebuild is needed
Sourcepub fn get_oldest_update_age(&self) -> Option<Duration>
pub fn get_oldest_update_age(&self) -> Option<Duration>
Get the age of the oldest pending update
Sourcepub fn get_stale_updates(&self, max_age: Duration) -> Vec<String>
pub fn get_stale_updates(&self, max_age: Duration) -> Vec<String>
Get all updates that are older than the specified duration
Sourcepub fn clear_stale_updates(&self, max_age: Duration)
pub fn clear_stale_updates(&self, max_age: Duration)
Force clear stale updates (useful for cleanup)
Trait Implementations§
Source§impl Clone for HmrContext
impl Clone for HmrContext
Source§fn clone(&self) -> HmrContext
fn clone(&self) -> HmrContext
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HmrContext
impl Debug for HmrContext
Auto Trait Implementations§
impl Freeze for HmrContext
impl RefUnwindSafe for HmrContext
impl Send for HmrContext
impl Sync for HmrContext
impl Unpin for HmrContext
impl UnwindSafe for HmrContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more