pub struct WatchCache { /* private fields */ }Expand description
Baselines of every watched .rs file, content hashes of watched non-.rs web assets, and
per-path hashes of the last attempted build so failed Tier-2 builds and repeated ForceScan
calls don’t loop on unchanged files.
Implementations§
Source§impl WatchCache
impl WatchCache
pub fn new() -> Self
Sourcepub fn with_workspace_root(root: impl Into<PathBuf>) -> Self
pub fn with_workspace_root(root: impl Into<PathBuf>) -> Self
Creates a watch cache bound to an explicit Cargo workspace_root (from AppContext) so
workspace-relative AnchorKey paths match view-macros without manifest heuristics.
Sourcepub fn snapshot_roots(roots: &[PathBuf]) -> WatchSnapshot
pub fn snapshot_roots(roots: &[PathBuf]) -> WatchSnapshot
Reads all .rs files under roots into an in-memory snapshot BEFORE starting cargo build.
Sourcepub fn snapshot_roots_with_assets(
roots: &[PathBuf],
asset_paths: &[PathBuf],
excluded_dirs: &[PathBuf],
) -> WatchSnapshot
pub fn snapshot_roots_with_assets( roots: &[PathBuf], asset_paths: &[PathBuf], excluded_dirs: &[PathBuf], ) -> WatchSnapshot
Reads all .rs files under roots and hashes all non-.rs asset files under
asset_paths (skipping ignored dirs and excluded_dirs) BEFORE starting a build.
Sourcepub fn adopt_snapshot(&mut self, snap: WatchSnapshot)
pub fn adopt_snapshot(&mut self, snap: WatchSnapshot)
Adopts a pre-build snapshot as the new Tier-1 good baseline after a successful Tier-2 build.
Sourcepub fn record_attempted_snapshot(
&mut self,
snap: &WatchSnapshot,
extra_paths: &[PathBuf],
)
pub fn record_attempted_snapshot( &mut self, snap: &WatchSnapshot, extra_paths: &[PathBuf], )
Records the exact content hashes attempted in a failed Tier-2 build (without clobbering the
last good Tier-1 baselines) so repeated nv dev wait calls don’t re-run Cargo on the
same unchanged broken file.
Sourcepub fn seed_dir(&mut self, dir: &Path)
pub fn seed_dir(&mut self, dir: &Path)
Recursively loads all .rs files under dir as Tier-1 diff baselines (lexed lazily).
Sourcepub fn disk_changed_paths(
&self,
roots: &[PathBuf],
filter: &[PathBuf],
) -> Vec<PathBuf>
pub fn disk_changed_paths( &self, roots: &[PathBuf], filter: &[PathBuf], ) -> Vec<PathBuf>
Scans roots (or filter paths/directories when non-empty) on disk and returns every
watched file whose content changed (or was deleted) since the last attempted cycle.
Sourcepub fn disk_changed_paths_with_assets(
&self,
roots: &[PathBuf],
asset_paths: &[PathBuf],
excluded_dirs: &[PathBuf],
filter: &[PathBuf],
) -> Vec<PathBuf>
pub fn disk_changed_paths_with_assets( &self, roots: &[PathBuf], asset_paths: &[PathBuf], excluded_dirs: &[PathBuf], filter: &[PathBuf], ) -> Vec<PathBuf>
Scans .rs files under roots and non-.rs web assets under asset_paths (or filter
paths/directories when non-empty) on disk and returns every changed/deleted file.
Sourcepub fn classify_batch(
&mut self,
paths: &[PathBuf],
generation: u64,
) -> Result<Vec<ClassifiedFilePatch>, String>
pub fn classify_batch( &mut self, paths: &[PathBuf], generation: u64, ) -> Result<Vec<ClassifiedFilePatch>, String>
Atomic two-phase batch classification through crate::view_diff::classify_for_watch:
classifies every path WITHOUT mutating any baseline first, and only commits updated
baselines when every file resolves as FileDiff::NoOp or FileDiff::Tier1. A
FileDiff::Tier2 keeps every old baseline so broken intermediate syntax never poisons it.