pub struct BuildCache {
pub config_hash: String,
pub entries: BTreeMap<PathBuf, CacheEntry>,
}Expand description
Incremental build cache. Maps relative path → CacheEntry.
config_hash auto-invalidates entries whenever either the project
config or the nodex binary version changes — the latter guards
against struct-shape drift in Node / Edge / RawEdge after an
upgrade. The hash is computed by builder::build; this struct
only stores it for comparison on the next load.
Fields§
§config_hash: String§entries: BTreeMap<PathBuf, CacheEntry>Implementations§
Source§impl BuildCache
impl BuildCache
Sourcepub fn load(
cache_path: &Path,
current_config_hash: &str,
) -> (Self, Option<String>)
pub fn load( cache_path: &Path, current_config_hash: &str, ) -> (Self, Option<String>)
Load cache from disk. Returns empty cache when the file is absent, unreadable, corrupt, or was produced under a different config hash. The second return value is an optional warning string explaining why — callers surface it so users see why an unexpectedly-slow rebuild is happening.
Sourcepub fn get(&self, rel_path: &Path, content: &str) -> Option<&CacheEntry>
pub fn get(&self, rel_path: &Path, content: &str) -> Option<&CacheEntry>
Get cached parse result if fresh.
Sourcepub fn insert(
&mut self,
rel_path: PathBuf,
content: &str,
node: Node,
raw_edges: &[RawEdge],
)
pub fn insert( &mut self, rel_path: PathBuf, content: &str, node: Node, raw_edges: &[RawEdge], )
Store a parse result.
Sourcepub fn retain_paths(&mut self, valid_paths: &[PathBuf])
pub fn retain_paths(&mut self, valid_paths: &[PathBuf])
Remove entries for paths no longer in scope.
Trait Implementations§
Source§impl Debug for BuildCache
impl Debug for BuildCache
Source§impl Default for BuildCache
impl Default for BuildCache
Source§fn default() -> BuildCache
fn default() -> BuildCache
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BuildCache
impl<'de> Deserialize<'de> for BuildCache
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BuildCache
impl RefUnwindSafe for BuildCache
impl Send for BuildCache
impl Sync for BuildCache
impl Unpin for BuildCache
impl UnsafeUnpin for BuildCache
impl UnwindSafe for BuildCache
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> 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