pub struct ParseCache { /* private fields */ }Available on crate feature
parser-ruff only.Implementations§
Source§impl ParseCache
impl ParseCache
Sourcepub fn peek(&self, path: &Path) -> Option<ParseOutcome>
pub fn peek(&self, path: &Path) -> Option<ParseOutcome>
Retrieve a cached ParseOutcome without re-parsing. Returns
None when the file has not been parsed yet (or was invalidated).
Useful for read-only consumers like a /metrics exporter.
Sourcepub fn get_or_parse(&self, path: &Path) -> Result<ParseOutcome, ParseError>
pub fn get_or_parse(&self, path: &Path) -> Result<ParseOutcome, ParseError>
Parse path if the cached hash differs from the on-disk hash, or
return the cached ParseOutcome when they match.
§Errors
Returns ParseError::Io if the file cannot be read, or
ParseError::Parse / ParseError::InvalidIdentifier if the
underlying parse fails.
Sourcepub fn invalidate(&self, path: &Path)
pub fn invalidate(&self, path: &Path)
Drop the cache entry for path, if any. Used by the
dag-processor when its watcher reports a delete / unlink.
Trait Implementations§
Source§impl Clone for ParseCache
impl Clone for ParseCache
Source§fn clone(&self) -> ParseCache
fn clone(&self) -> ParseCache
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 moreSource§impl Debug for ParseCache
impl Debug for ParseCache
Source§impl Default for ParseCache
impl Default for ParseCache
Source§fn default() -> ParseCache
fn default() -> ParseCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ParseCache
impl !RefUnwindSafe for ParseCache
impl Send for ParseCache
impl Sync for ParseCache
impl Unpin for ParseCache
impl UnsafeUnpin for ParseCache
impl !UnwindSafe for ParseCache
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> 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