pub struct FileCache { /* private fields */ }Expand description
File-based cache manager for test result caching
London School TDD Design:
- Implements Cache trait for collaboration contract
- Thread-safe with Arc<Mutex<>> for concurrent access
- Proper error handling with Result<T, CleanroomError>
- No unwrap() or expect() calls
§Example
use clnrm_core::cache::{FileCache, Cache};
use std::path::Path;
let cache = FileCache::new()?;
let file_path = Path::new("tests/api.clnrm.toml");
let content = "rendered content";
if cache.has_changed(file_path, content)? {
// Run test
cache.update(file_path, content)?;
cache.save()?;
}Implementations§
Trait Implementations§
Source§impl Cache for FileCache
impl Cache for FileCache
Source§fn has_changed(&self, file_path: &Path, rendered_content: &str) -> Result<bool>
fn has_changed(&self, file_path: &Path, rendered_content: &str) -> Result<bool>
Check if a file has changed since last cache update Read more
Source§fn update(&self, file_path: &Path, rendered_content: &str) -> Result<()>
fn update(&self, file_path: &Path, rendered_content: &str) -> Result<()>
Update cache with new file hash Read more
Source§fn stats(&self) -> Result<CacheStats>
fn stats(&self) -> Result<CacheStats>
Get cache statistics
Auto Trait Implementations§
impl Freeze for FileCache
impl RefUnwindSafe for FileCache
impl Send for FileCache
impl Sync for FileCache
impl Unpin for FileCache
impl UnwindSafe for FileCache
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request