pub struct AstCacheV2 { /* private fields */ }Expand description
Modern async AST cache with bounded memory and timeout protection
Implementations§
Source§impl AstCacheV2
impl AstCacheV2
Sourcepub fn with_config(
capacity: u64,
ttl: Duration,
parse_timeout: Duration,
) -> Self
pub fn with_config( capacity: u64, ttl: Duration, parse_timeout: Duration, ) -> Self
Create a new AST cache with custom configuration
Sourcepub async fn get_or_parse(
&self,
path: &Path,
content: &str,
language: &str,
) -> Result<Arc<Tree>, ContextCreatorError>
pub async fn get_or_parse( &self, path: &Path, content: &str, language: &str, ) -> Result<Arc<Tree>, ContextCreatorError>
Get or parse an AST for the given file
Sourcepub async fn get_content(
&self,
path: &Path,
content_hash: &str,
language: &str,
) -> Option<Arc<String>>
pub async fn get_content( &self, path: &Path, content_hash: &str, language: &str, ) -> Option<Arc<String>>
Get cached content for a file if available
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Clone for AstCacheV2
impl Clone for AstCacheV2
Source§fn clone(&self) -> AstCacheV2
fn clone(&self) -> AstCacheV2
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AstCacheV2
impl !RefUnwindSafe for AstCacheV2
impl Send for AstCacheV2
impl Sync for AstCacheV2
impl Unpin for AstCacheV2
impl !UnwindSafe for AstCacheV2
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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