pub struct ScanCache {
pub version: u32,
pub updated_at: u64,
pub projects: HashMap<PathBuf, CachedProject>,
pub directories: HashMap<PathBuf, CachedDirectory>,
}Expand description
The scan cache
Fields§
§version: u32Version for cache invalidation on format changes
updated_at: u64When the cache was last updated
projects: HashMap<PathBuf, CachedProject>Cached projects by their root path
directories: HashMap<PathBuf, CachedDirectory>Cached directory scan info
Implementations§
Source§impl ScanCache
impl ScanCache
Sourcepub fn get_valid_project(&self, root: &Path) -> Option<&CachedProject>
pub fn get_valid_project(&self, root: &Path) -> Option<&CachedProject>
Check if a project is still valid in cache
Sourcepub fn directory_needs_rescan(&self, path: &Path) -> bool
pub fn directory_needs_rescan(&self, path: &Path) -> bool
Check if a directory needs to be rescanned
Sourcepub fn cache_project(&mut self, project: Project)
pub fn cache_project(&mut self, project: Project)
Cache a project
Sourcepub fn cache_directory(&mut self, path: PathBuf, project_roots: Vec<PathBuf>)
pub fn cache_directory(&mut self, path: PathBuf, project_roots: Vec<PathBuf>)
Cache a directory scan result
Sourcepub fn get_all_valid_projects(&self) -> Vec<Project>
pub fn get_all_valid_projects(&self) -> Vec<Project>
Get all valid cached projects
Sourcepub fn project_count(&self) -> usize
pub fn project_count(&self) -> usize
Number of cached projects
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ScanCache
impl<'de> Deserialize<'de> for ScanCache
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 ScanCache
impl RefUnwindSafe for ScanCache
impl Send for ScanCache
impl Sync for ScanCache
impl Unpin for ScanCache
impl UnwindSafe for ScanCache
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> 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