pub struct BuildCache { /* private fields */ }Expand description
Incremental build cache backed by a JSON file.
Implementations§
Source§impl BuildCache
impl BuildCache
Sourcepub fn load(content_root: &Path) -> Result<Self, String>
pub fn load(content_root: &Path) -> Result<Self, String>
Load cache from file, or create empty if file doesn’t exist or is invalid.
§Errors
Returns an error if the file exists but cannot be read.
Sourcepub fn is_unchanged(&self, path: &str, current_hash: &str) -> bool
pub fn is_unchanged(&self, path: &str, current_hash: &str) -> bool
Check if a file is unchanged since last build.
Returns true if the file hash matches the cache and all dependencies
are also unchanged.
Sourcepub fn is_unchanged_with_hashes(
&self,
path: &str,
current_hash: &str,
current_hashes: &HashMap<String, String>,
) -> bool
pub fn is_unchanged_with_hashes( &self, path: &str, current_hash: &str, current_hashes: &HashMap<String, String>, ) -> bool
Check if a file and all its dependencies are unchanged, given a map of current file hashes.
Sourcepub fn put(&mut self, path: &str, hash: String, deps: Vec<String>)
pub fn put(&mut self, path: &str, hash: String, deps: Vec<String>)
Record a file’s hash and dependencies in the cache.
Sourcepub fn prune(&mut self, existing_files: &HashSet<String>)
pub fn prune(&mut self, existing_files: &HashSet<String>)
Remove entries for files that no longer exist.
Trait Implementations§
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> 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