pub struct Cache {
root: PathBuf,
path: PathBuf,
executable: Option<Checksum>,
formatter: Option<Checksum>,
state: Mutex<State>,
}Expand description
Cache bound to one workspace and the exact tools executing this run.
Fields§
§root: PathBuf§path: PathBuf§executable: Option<Checksum>§formatter: Option<Checksum>§state: Mutex<State>Implementations§
Source§impl Cache
impl Cache
Sourcepub fn load(
root: &Path,
executable: Option<Checksum>,
formatter: Option<Checksum>,
) -> Self
pub fn load( root: &Path, executable: Option<Checksum>, formatter: Option<Checksum>, ) -> Self
Load the cache when it is present and valid.
Malformed or unreadable cache data is treated as a cold cache.
Sourcepub fn is_current(
&self,
workspace: Option<&TreeSnapshot>,
filters: &[Box<str>],
require_metadata_validation: bool,
) -> bool
pub fn is_current( &self, workspace: Option<&TreeSnapshot>, filters: &[Box<str>], require_metadata_validation: bool, ) -> bool
Return whether a previous successful run proves every selected output current.
Sourcepub fn reuse_formatted(&self, output: &Path, rendered: &str) -> Option<String>
pub fn reuse_formatted(&self, output: &Path, rendered: &str) -> Option<String>
Reuse the existing formatted output when its complete formatter input and output match.
Sourcepub fn record_formatted(&self, output: &Path, rendered: &str, formatted: &str)
pub fn record_formatted(&self, output: &Path, rendered: &str, formatted: &str)
Record one successfully formatted template.
Sourcepub fn record_success(
&self,
workspace: &TreeSnapshot,
filters: &[Box<str>],
output_paths: &[PathBuf],
metadata_validated: bool,
)
pub fn record_success( &self, workspace: &TreeSnapshot, filters: &[Box<str>], output_paths: &[PathBuf], metadata_validated: bool, )
Record a successful run after every selected output is known to be current.
Sourcepub fn persist(&self)
pub fn persist(&self)
Persist the current cache atomically.
Cache persistence failures do not affect generator correctness.
fn state(&self) -> MutexGuard<'_, State>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl UnwindSafe for Cache
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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