pub struct TreeSitterEngine { /* private fields */ }Expand description
A tree-sitter parsing engine that supports multiple languages.
Manages a cache of language-specific parsers and provides
a unified interface for parsing source files.
Uses a Mutex for interior mutability so parsing works with &self
and is thread-safe (required by rayon-based parallel analysis).
Implementations§
Source§impl TreeSitterEngine
impl TreeSitterEngine
Sourcepub fn ensure_parser(&self, lang: Language) -> bool
pub fn ensure_parser(&self, lang: Language) -> bool
Ensure a parser is available for the given language. Returns true if the parser was successfully loaded (or already exists).
Sourcepub fn parse(&self, lang: Language, content: &str) -> Option<Tree>
pub fn parse(&self, lang: Language, content: &str) -> Option<Tree>
Parse source code for the given language. Returns None if the language has no loaded parser or parsing fails.
Sourcepub fn parse_file(&self, path: &Path, content: &str) -> Option<ParsedFile>
pub fn parse_file(&self, path: &Path, content: &str) -> Option<ParsedFile>
Parse a file, detecting language from its path. Returns None if the language is unsupported or parsing fails.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TreeSitterEngine
impl RefUnwindSafe for TreeSitterEngine
impl Send for TreeSitterEngine
impl Sync for TreeSitterEngine
impl Unpin for TreeSitterEngine
impl UnsafeUnpin for TreeSitterEngine
impl UnwindSafe for TreeSitterEngine
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