pub struct AnalysisDefFingerprint {
pub source_files: RapidSet<PathBuf>,
pub fingerprint: Fingerprint,
pub last_analyzed: Option<i64>,
}Expand description
Tracks the fingerprint and source files for an analysis result.
Adapted from ReCoco’s FieldDefFingerprint pattern. Combines content
fingerprinting with source file tracking to enable precise invalidation
scope determination.
§Examples
use thread_flow::incremental::types::AnalysisDefFingerprint;
// Create a fingerprint from file content
let fp = AnalysisDefFingerprint::new(b"fn main() {}");
assert!(fp.content_matches(b"fn main() {}"));
assert!(!fp.content_matches(b"fn other() {}"));Fields§
§source_files: RapidSet<PathBuf>Source files that contribute to this analysis result. Used to determine invalidation scope when dependencies change.
fingerprint: FingerprintContent fingerprint of the analyzed file (Blake3, 16 bytes). Combines file content hash for change detection.
last_analyzed: Option<i64>Timestamp of last successful analysis (Unix microseconds).
None if this fingerprint has never been persisted.
Implementations§
Source§impl AnalysisDefFingerprint
impl AnalysisDefFingerprint
Sourcepub fn new(content: &[u8]) -> Self
pub fn new(content: &[u8]) -> Self
Creates a new fingerprint from raw file content bytes.
Computes a Blake3-based fingerprint of the content using ReCoco’s
Fingerprinter builder pattern.
§Arguments
content- The raw bytes of the file to fingerprint.
§Examples
use thread_flow::incremental::types::AnalysisDefFingerprint;
let fp = AnalysisDefFingerprint::new(b"hello world");
assert!(fp.content_matches(b"hello world"));Sourcepub fn with_sources(content: &[u8], source_files: RapidSet<PathBuf>) -> Self
pub fn with_sources(content: &[u8], source_files: RapidSet<PathBuf>) -> Self
Creates a new fingerprint with associated source files.
The source files represent the set of files that contributed to this analysis result, enabling precise invalidation scope.
§Arguments
content- The raw bytes of the primary file.source_files- Files that contributed to this analysis.
§Examples
use thread_flow::incremental::types::AnalysisDefFingerprint;
use thread_utilities::RapidSet;
use std::path::PathBuf;
let sources = RapidSet::from([PathBuf::from("dep.rs")]);
let fp = AnalysisDefFingerprint::with_sources(b"content", sources);
assert_eq!(fp.source_files.len(), 1);Sourcepub fn update_fingerprint(&self, content: &[u8]) -> Self
pub fn update_fingerprint(&self, content: &[u8]) -> Self
Updates the fingerprint with new content, preserving source files.
Returns a new AnalysisDefFingerprint with an updated fingerprint
computed from the new content bytes.
§Arguments
content- The new raw bytes to fingerprint.
§Examples
use thread_flow::incremental::types::AnalysisDefFingerprint;
let fp = AnalysisDefFingerprint::new(b"old content");
let updated = fp.update_fingerprint(b"new content");
assert!(!updated.content_matches(b"old content"));
assert!(updated.content_matches(b"new content"));Sourcepub fn content_matches(&self, content: &[u8]) -> bool
pub fn content_matches(&self, content: &[u8]) -> bool
Checks if the given content matches this fingerprint.
Computes a fresh fingerprint from the content and compares it byte-for-byte with the stored fingerprint.
§Arguments
content- The raw bytes to check against the stored fingerprint.
§Examples
use thread_flow::incremental::types::AnalysisDefFingerprint;
let fp = AnalysisDefFingerprint::new(b"fn main() {}");
assert!(fp.content_matches(b"fn main() {}"));
assert!(!fp.content_matches(b"fn main() { println!(); }"));Sourcepub fn add_source_file(&mut self, path: PathBuf)
pub fn add_source_file(&mut self, path: PathBuf)
Sourcepub fn remove_source_file(&mut self, path: &Path) -> bool
pub fn remove_source_file(&mut self, path: &Path) -> bool
Sourcepub fn set_last_analyzed(&mut self, timestamp: i64)
pub fn set_last_analyzed(&mut self, timestamp: i64)
Sourcepub fn source_file_count(&self) -> usize
pub fn source_file_count(&self) -> usize
Returns the number of source files tracked.
Sourcepub fn fingerprint(&self) -> &Fingerprint
pub fn fingerprint(&self) -> &Fingerprint
Returns a reference to the underlying Fingerprint.
Trait Implementations§
Source§impl Clone for AnalysisDefFingerprint
impl Clone for AnalysisDefFingerprint
Source§fn clone(&self) -> AnalysisDefFingerprint
fn clone(&self) -> AnalysisDefFingerprint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AnalysisDefFingerprint
impl RefUnwindSafe for AnalysisDefFingerprint
impl Send for AnalysisDefFingerprint
impl Sync for AnalysisDefFingerprint
impl Unpin for AnalysisDefFingerprint
impl UnsafeUnpin for AnalysisDefFingerprint
impl UnwindSafe for AnalysisDefFingerprint
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
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>
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>
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