pub struct FileCache { /* private fields */ }Expand description
In-memory cache of recently read files.
Implementations§
Source§impl FileCache
impl FileCache
pub fn new() -> Self
Sourcepub fn read(&mut self, path: &Path) -> Result<String, String>
pub fn read(&mut self, path: &Path) -> Result<String, String>
Read a file, returning cached content if still fresh.
Sourcepub fn invalidate(&mut self, path: &Path)
pub fn invalidate(&mut self, path: &Path)
Invalidate the cache entry for a file (e.g., after a write).
Sourcepub fn last_read_mtime(&self, path: &Path) -> Option<SystemTime>
pub fn last_read_mtime(&self, path: &Path) -> Option<SystemTime>
Return the mtime recorded when a file was last read into the cache.
Returns None if the file is not cached.
Auto Trait Implementations§
impl Freeze for FileCache
impl RefUnwindSafe for FileCache
impl Send for FileCache
impl Sync for FileCache
impl Unpin for FileCache
impl UnsafeUnpin 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