pub struct ASTCache { /* private fields */ }Expand description
Cache of parsed ASTs keyed by file path. Avoids re-parsing files that haven’t changed.
Implementations§
Source§impl ASTCache
impl ASTCache
pub fn new() -> Self
Sourcepub fn get_tree(&mut self, path: &Path) -> Option<(Tree, Lang)>
pub fn get_tree(&mut self, path: &Path) -> Option<(Tree, Lang)>
Parse a file and return its AST tree + detected language. Uses cache if the file hasn’t been modified since last parse. Parse a file and return its AST tree + detected language. Uses cache if the file hasn’t been modified since last parse.
Sourcepub fn parse_source(&mut self, source: &str, lang: Lang) -> Option<Tree>
pub fn parse_source(&mut self, source: &str, lang: Lang) -> Option<Tree>
Parse source code directly (not from file). No caching.
Sourcepub fn invalidate(&mut self, path: &Path)
pub fn invalidate(&mut self, path: &Path)
Invalidate cache for a specific file (e.g. after edit_file).
Auto Trait Implementations§
impl Freeze for ASTCache
impl RefUnwindSafe for ASTCache
impl Send for ASTCache
impl Sync for ASTCache
impl Unpin for ASTCache
impl UnsafeUnpin for ASTCache
impl UnwindSafe for ASTCache
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> 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 more