pub struct CodeCache { /* private fields */ }Expand description
Per-file cache of parsed CodeElement trees with mtime invalidation.
Implementations§
Source§impl CodeCache
impl CodeCache
Sourcepub fn new(project_root: &Path) -> Self
pub fn new(project_root: &Path) -> Self
Create an empty cache rooted at the given project directory.
Sourcepub fn ensure_scope(&mut self, scope: &Scope, resolvers: &ResolverRegistry)
pub fn ensure_scope(&mut self, scope: &Scope, resolvers: &ResolverRegistry)
Lazily parse all code files within scope. Skips cached+fresh files. Uses rayon for parallel parsing of stale/missing files.
Sourcepub fn refresh_if_stale(
&mut self,
rel_path: &RelativePath,
resolvers: &ResolverRegistry,
) -> bool
pub fn refresh_if_stale( &mut self, rel_path: &RelativePath, resolvers: &ResolverRegistry, ) -> bool
Check mtime and re-parse a single file if stale. Returns true if re-parsed.
Sourcepub fn get(&self, rel_path: &RelativePath) -> Option<&CodeElement>
pub fn get(&self, rel_path: &RelativePath) -> Option<&CodeElement>
Get cached code element tree for a file.
Sourcepub fn elements_in_scope(
&self,
scope: &Scope,
) -> Vec<(&RelativePath, &CodeElement)>
pub fn elements_in_scope( &self, scope: &Scope, ) -> Vec<(&RelativePath, &CodeElement)>
Get all cached (rel_path, CodeElement) pairs within a scope prefix.
Auto Trait Implementations§
impl Freeze for CodeCache
impl RefUnwindSafe for CodeCache
impl Send for CodeCache
impl Sync for CodeCache
impl Unpin for CodeCache
impl UnsafeUnpin for CodeCache
impl UnwindSafe for CodeCache
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> 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