pub struct SimpleIndexer { /* private fields */ }Expand description
Simple file indexer.
Implementations§
Source§impl SimpleIndexer
impl SimpleIndexer
Sourcepub fn new(workspace_root: PathBuf) -> Self
pub fn new(workspace_root: PathBuf) -> Self
Create a new simple indexer with default VT Code paths.
Sourcepub fn with_index_dir(workspace_root: PathBuf, index_dir: PathBuf) -> Self
pub fn with_index_dir(workspace_root: PathBuf, index_dir: PathBuf) -> Self
Create a new simple indexer using a custom index directory.
Sourcepub fn hydrate_from_snapshot(&mut self) -> usize
pub fn hydrate_from_snapshot(&mut self) -> usize
Populate the index cache from the persisted snapshot so re-index runs
can skip unchanged files (see Self::index_directory). Entries
outside the workspace root, in excluded directories, with hidden
or sensitive names, or with .. segments are discarded so a tampered
snapshot can never surface files the indexer would refuse to index.
Existence is deliberately unchecked: the re-index diff needs deleted
files’ entries to prune them. A missing or malformed snapshot leaves
the cache empty and never fails. Returns the hydrated count.
Sourcepub fn workspace_root(&self) -> &Path
pub fn workspace_root(&self) -> &Path
Get the workspace root path.
Sourcepub fn index_directory(&mut self, dir_path: &Path) -> Result<()>
pub fn index_directory(&mut self, dir_path: &Path) -> Result<()>
Index all files in directory recursively. Respects .gitignore, .ignore, and other ignore files. SECURITY: Always skips hidden files and sensitive data (.env, .git, etc.)
Hydrated entries matching size and mtime are served without a read or
hash (see cached_or_built_index); an unchanged directory also skips
the whole-snapshot rewrite.
Sourcepub fn discover_files(&self, dir_path: &Path) -> Vec<String>
pub fn discover_files(&self, dir_path: &Path) -> Vec<String>
Discover all files in directory recursively without indexing them.
This is much faster than index_directory as it avoids hashing and persistence.
Sourcepub fn discover_dir_entries(&self, dir_path: &Path) -> Vec<(PathBuf, bool)>
pub fn discover_dir_entries(&self, dir_path: &Path) -> Vec<(PathBuf, bool)>
List the immediate children of dir_path (one level deep) without
recursing into subdirectories.
Uses the same ignore/hidden/excluded-directory rules as Self::discover_files
(via the shared traversal filter), so expensive subtrees such as
node_modules, .git, and build directories are never listed. This lets
callers build a directory navigator that only touches the directories the
user actually opens, instead of walking the entire workspace up front.
Returns (path, is_dir) pairs with directories sorted before files.
Sourcepub fn search(
&self,
pattern: &str,
path_filter: Option<&str>,
) -> Result<Vec<SearchResult>>
pub fn search( &self, pattern: &str, path_filter: Option<&str>, ) -> Result<Vec<SearchResult>>
Search files using regex pattern.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SimpleIndexer
impl !UnwindSafe for SimpleIndexer
impl Forget for SimpleIndexer
impl Freeze for SimpleIndexer
impl Send for SimpleIndexer
impl Sync for SimpleIndexer
impl Unpin for SimpleIndexer
impl UnsafeUnpin for SimpleIndexer
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