pub struct SimpleIndexer { /* private fields */ }Expand description
Simple file indexer.
Implementations§
Source§impl SimpleIndexer
impl SimpleIndexer
Sourcepub fn new(workspace_root: PathBuf) -> SimpleIndexer
pub fn new(workspace_root: PathBuf) -> SimpleIndexer
Create a new simple indexer with default VT Code paths.
Sourcepub fn with_index_dir(
workspace_root: PathBuf,
index_dir: PathBuf,
) -> SimpleIndexer
pub fn with_index_dir( workspace_root: PathBuf, index_dir: PathBuf, ) -> SimpleIndexer
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<(), Error>
pub fn index_directory(&mut self, dir_path: &Path) -> Result<(), Error>
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>, Error>
pub fn search( &self, pattern: &str, path_filter: Option<&str>, ) -> Result<Vec<SearchResult>, Error>
Search files using regex pattern.
Trait Implementations§
Source§impl Clone for SimpleIndexer
impl Clone for SimpleIndexer
Source§fn clone(&self) -> SimpleIndexer
fn clone(&self) -> SimpleIndexer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SimpleIndexer
impl !UnwindSafe for SimpleIndexer
impl Forget for SimpleIndexer
impl Freeze for SimpleIndexer
impl Move 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
impl<T> CacheValue for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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> 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