Skip to main content

WatchCache

Struct WatchCache 

Source
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

Source

pub fn new() -> Self

Source

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.

Source

pub fn snapshot_roots(roots: &[PathBuf]) -> WatchSnapshot

Reads all .rs files under roots into an in-memory snapshot BEFORE starting cargo build.

Source

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.

Source

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.

Source

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.

Source

pub fn seed_dir(&mut self, dir: &Path)

Recursively loads all .rs files under dir as Tier-1 diff baselines (lexed lazily).

Source

pub fn len(&self) -> usize

Number of .rs files currently cached.

Source

pub fn is_empty(&self) -> bool

Returns true when no .rs files are cached.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for WatchCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WatchCache

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more