pub struct ParserPool<'r> { /* private fields */ }Expand description
Lazily initialized parser and query cache for a language registry.
Implementations§
Source§impl<'r> ParserPool<'r>
impl<'r> ParserPool<'r>
Sourcepub fn new(registry: &'r LanguageRegistry) -> Self
pub fn new(registry: &'r LanguageRegistry) -> Self
Creates an empty cache backed by registry.
Sourcepub fn parser(&mut self, id: LanguageId) -> Option<&mut Parser>
pub fn parser(&mut self, id: LanguageId) -> Option<&mut Parser>
Returns a parser for id, creating and configuring it on first use.
A grammar rejected by tree-sitter is cached as a permanent miss.
Returns the compiled tags query for id.
Missing query sources and compilation failures are cached permanently.
Sourcepub fn imports_query(&mut self, id: LanguageId) -> Option<&Query>
pub fn imports_query(&mut self, id: LanguageId) -> Option<&Query>
Returns the compiled query-based import extractor for id.
Custom extractors, missing queries, and compilation failures are cached as permanent misses.
Sourcepub fn injections_query(&mut self, id: LanguageId) -> Option<&Query>
pub fn injections_query(&mut self, id: LanguageId) -> Option<&Query>
Returns the compiled injection query for id.
Missing query sources and compilation failures are cached permanently.
Auto Trait Implementations§
impl<'r> Freeze for ParserPool<'r>
impl<'r> RefUnwindSafe for ParserPool<'r>
impl<'r> Send for ParserPool<'r>
impl<'r> Sync for ParserPool<'r>
impl<'r> Unpin for ParserPool<'r>
impl<'r> UnsafeUnpin for ParserPool<'r>
impl<'r> UnwindSafe for ParserPool<'r>
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