pub struct HotReloader { /* private fields */ }Expand description
Tracks which blobs are active and manages hot-reload updates.
Implementations§
Source§impl HotReloader
impl HotReloader
pub fn new() -> Self
Sourcepub fn register_function(&mut self, name: String, blob: FunctionBlob)
pub fn register_function(&mut self, name: String, blob: FunctionBlob)
Register a function’s current blob.
Sourcepub fn add_active_reference(&mut self, hash: FunctionHash)
pub fn add_active_reference(&mut self, hash: FunctionHash)
Mark a blob hash as actively referenced (in a call frame).
Sourcepub fn remove_active_reference(&mut self, hash: FunctionHash)
pub fn remove_active_reference(&mut self, hash: FunctionHash)
Remove an active reference (frame exited).
Sourcepub fn apply_patches(&mut self, patches: Vec<FunctionPatch>) -> ReloadResult
pub fn apply_patches(&mut self, patches: Vec<FunctionPatch>) -> ReloadResult
Apply a set of function patches (updated blobs).
Sourcepub fn current_hash(&self, name: &str) -> Option<&FunctionHash>
pub fn current_hash(&self, name: &str) -> Option<&FunctionHash>
Get the current hash for a function name.
Sourcepub fn get_blob(&self, hash: &FunctionHash) -> Option<&FunctionBlob>
pub fn get_blob(&self, hash: &FunctionHash) -> Option<&FunctionBlob>
Get a blob by hash (works for both current and retained old blobs).
Sourcepub fn gc(&mut self) -> usize
pub fn gc(&mut self) -> usize
Run garbage collection: remove old blobs with no active references.
Returns the number of blobs removed.
Sourcepub fn history(&self) -> &[ReloadEvent]
pub fn history(&self) -> &[ReloadEvent]
Get reload history.
Sourcepub fn watch_path(&mut self, path: PathBuf)
pub fn watch_path(&mut self, path: PathBuf)
Add a path to watch for changes.
Sourcepub fn watched_paths(&self) -> &[PathBuf]
pub fn watched_paths(&self) -> &[PathBuf]
Get all watched paths.
Sourcepub fn compute_affected_functions(
&self,
_changed_files: &[PathBuf],
) -> Vec<String>
pub fn compute_affected_functions( &self, _changed_files: &[PathBuf], ) -> Vec<String>
Compute which functions need recompilation given a set of changed source files.
For now, returns all functions (conservative). Future: use source map to narrow down.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HotReloader
impl RefUnwindSafe for HotReloader
impl Send for HotReloader
impl Sync for HotReloader
impl Unpin for HotReloader
impl UnsafeUnpin for HotReloader
impl UnwindSafe for HotReloader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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