pub struct ContentCache<L: Language + Send + Sync + 'static> { /* private fields */ }Expand description
A content-based cache for parsed results.
This cache stores parsed results based on the hash of the source content, allowing for efficient reuse of parsing results when processing the same content multiple times.
Implementations§
Source§impl<L: Language + Send + Sync + 'static> ContentCache<L>
impl<L: Language + Send + Sync + 'static> ContentCache<L>
Sourcepub fn new(max_entries: usize) -> Self
pub fn new(max_entries: usize) -> Self
Creates a new content cache with the specified maximum size.
Sourcepub fn get<S: Source + ?Sized>(
&self,
source: &S,
) -> Option<(&GreenNode<'_, L>, &LexOutput<L>)>
pub fn get<S: Source + ?Sized>( &self, source: &S, ) -> Option<(&GreenNode<'_, L>, &LexOutput<L>)>
Gets a cached entry for the given source content if it exists.
Trait Implementations§
Auto Trait Implementations§
impl<L> Freeze for ContentCache<L>
impl<L> !RefUnwindSafe for ContentCache<L>
impl<L> Send for ContentCache<L>
impl<L> Sync for ContentCache<L>
impl<L> Unpin for ContentCache<L>
impl<L> UnsafeUnpin for ContentCache<L>
impl<L> !UnwindSafe for ContentCache<L>
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