pub struct CodeIndex {
pub symbols: Vec<Symbol>,
pub calls: Vec<CallEdge>,
pub imports: Vec<ImportEdge>,
pub files: Vec<PathBuf>,
pub root: PathBuf,
pub file_mtimes: HashMap<PathBuf, u64>,
/* private fields */
}Fields§
§symbols: Vec<Symbol>§calls: Vec<CallEdge>§imports: Vec<ImportEdge>§files: Vec<PathBuf>§root: PathBuf§file_mtimes: HashMap<PathBuf, u64>File -> mtime in millis since UNIX_EPOCH. Used for incremental re-index.
Implementations§
Source§impl CodeIndex
impl CodeIndex
pub fn build( parsed: Vec<ParsedFile>, root: &Path, embedder: Option<&dyn Embedder>, ) -> Self
Sourcepub fn collect_mtimes(root: &Path) -> HashMap<PathBuf, u64>
pub fn collect_mtimes(root: &Path) -> HashMap<PathBuf, u64>
Collect current modification times for all source files under root. Returns a map from absolute file path → millis since UNIX_EPOCH.
Sourcepub fn classify_files(
&self,
current: &HashMap<PathBuf, u64>,
) -> (Vec<PathBuf>, Vec<PathBuf>)
pub fn classify_files( &self, current: &HashMap<PathBuf, u64>, ) -> (Vec<PathBuf>, Vec<PathBuf>)
Given current mtimes, return (unchanged_files, changed_or_new_files)
by comparing against stored file_mtimes.
Sourcepub fn reconstruct_parsed_file(&self, path: &Path) -> ParsedFile
pub fn reconstruct_parsed_file(&self, path: &Path) -> ParsedFile
Reconstruct a ParsedFile from stored index data for a given file.
Used to avoid re-parsing unchanged files during incremental re-index.
Sourcepub fn apply_changes(&mut self, changed: &[PathBuf], new_parsed: &[ParsedFile])
pub fn apply_changes(&mut self, changed: &[PathBuf], new_parsed: &[ParsedFile])
Incrementally update the index: remove old data for changed files,
add new_parsed data, rebuild lookup maps, and re-resolve cross-file refs.
Embeddings are NOT handled here — the caller should call
preserve_embeddings() or compute_missing_embeddings() afterward.
Sourcepub fn compute_missing_embeddings(&mut self, embedder: &dyn Embedder)
pub fn compute_missing_embeddings(&mut self, embedder: &dyn Embedder)
Compute embeddings only for symbols that don’t already have one.
Sourcepub fn preserve_embeddings(&mut self, old: &CodeIndex)
pub fn preserve_embeddings(&mut self, old: &CodeIndex)
Copy embeddings from an older index for symbols that still exist in this index, matched by (name, file, line).