pub struct FilePicker {
pub mode: FfsMode,
pub base_path: PathBuf,
/* private fields */
}Fields§
§mode: FfsMode§base_path: PathBufImplementations§
Source§impl FilePicker
impl FilePicker
pub fn base_path(&self) -> &Path
pub fn has_mmap_cache(&self) -> bool
pub fn has_content_indexing(&self) -> bool
pub fn has_watcher(&self) -> bool
pub fn mode(&self) -> FfsMode
pub fn cache_budget(&self) -> &ContentCacheBudget
pub fn bigram_index(&self) -> Option<&BigramFilter>
pub fn bigram_overlay(&self) -> Option<&RwLock<BigramOverlay>>
pub fn get_file_mut(&mut self, index: usize) -> Option<&mut FileItem>
Sourcepub fn git_root(&self) -> Option<&Path>
pub fn git_root(&self) -> Option<&Path>
Absolute path to the repository root if the indexed tree lives
inside a git working directory. None for non-git bases.
pub fn has_explicit_cache_budget(&self) -> bool
pub fn set_cache_budget(&mut self, budget: ContentCacheBudget)
Sourcepub fn get_files(&self) -> &[FileItem]
pub fn get_files(&self) -> &[FileItem]
Get all indexed files sorted by path. Note: Files are stored sorted by PATH for efficient insert/remove. For frecency-sorted results, use search() which sorts matched results.
pub fn get_overflow_files(&self) -> &[FileItem]
Sourcepub fn arena_bytes(&self) -> (usize, usize, usize)
pub fn arena_bytes(&self) -> (usize, usize, usize)
Actual heap bytes used: (chunked_path_store, 0, 0). The second element is 0 because leaked overflow stores aren’t tracked.
Sourcepub fn new(options: FilePickerOptions) -> Result<Self, Error>
pub fn new(options: FilePickerOptions) -> Result<Self, Error>
Create a new FilePicker from options. Always prefer new_with_shared_state for the consumer application, use this only if you know what you are doing. This won’t spawn the backgraound watcher and won’t walk the file tree.
Create a picker, place it into the shared handle, and spawn background indexing + file-system watcher. This is the default entry point.
Sourcepub fn collect_files(&mut self) -> Result<(), Error>
pub fn collect_files(&mut self) -> Result<(), Error>
Synchronous filesystem scan — populates self with indexed files.
Use this when you need direct access to the picker without shared state:
let mut picker = FilePicker::new(options)?;
picker.collect_files()?;
// picker.get_files() is now populatedSourcepub fn spawn_background_watcher(
&mut self,
shared_picker: &SharedFilePicker,
shared_frecency: &SharedFrecency,
) -> Result<(), Error>
pub fn spawn_background_watcher( &mut self, shared_picker: &SharedFilePicker, shared_frecency: &SharedFrecency, ) -> Result<(), Error>
Start the background file-system watcher.
The picker must already be placed into shared_picker (the watcher
needs the shared handle to apply live updates). Call after
collect_files or after an initial scan.
Sourcepub fn fuzzy_search<'q>(
&self,
query: &'q FfsQuery<'q>,
query_tracker: Option<&QueryTracker>,
options: FuzzySearchOptions<'q>,
) -> SearchResult<'_>
pub fn fuzzy_search<'q>( &self, query: &'q FfsQuery<'q>, query_tracker: Option<&QueryTracker>, options: FuzzySearchOptions<'q>, ) -> SearchResult<'_>
Perform fuzzy search on files with a pre-parsed query.
The query should be parsed using FfsQuery::parse() before calling
this function. If a QueryTracker is provided, the search will
automatically look up the last selected file for this query and boost it
Sourcepub fn fuzzy_search_directories<'q>(
&self,
query: &'q FfsQuery<'q>,
options: FuzzySearchOptions<'q>,
) -> DirSearchResult<'_>
pub fn fuzzy_search_directories<'q>( &self, query: &'q FfsQuery<'q>, options: FuzzySearchOptions<'q>, ) -> DirSearchResult<'_>
Perform fuzzy search on indexed directories.
Returns directories ranked by fuzzy match quality + frecency.
Sourcepub fn fuzzy_search_mixed<'q>(
&self,
query: &'q FfsQuery<'q>,
query_tracker: Option<&QueryTracker>,
options: FuzzySearchOptions<'q>,
) -> MixedSearchResult<'_>
pub fn fuzzy_search_mixed<'q>( &self, query: &'q FfsQuery<'q>, query_tracker: Option<&QueryTracker>, options: FuzzySearchOptions<'q>, ) -> MixedSearchResult<'_>
Perform a mixed fuzzy search across both files and directories.
Returns a single flat list where files and directories are interleaved by total score in descending order.
If the raw query ends with a path separator (/), only directories
are searched — files are skipped entirely. The caller should parse the
query with DirSearchConfig so that trailing / is kept as fuzzy
text instead of becoming a PathSegment constraint.
Sourcepub fn grep(
&self,
query: &FfsQuery<'_>,
options: &GrepSearchOptions,
) -> GrepResult<'_>
pub fn grep( &self, query: &FfsQuery<'_>, options: &GrepSearchOptions, ) -> GrepResult<'_>
Perform a live grep search across indexed files.
If options.abort_signal is set it overrides the picker’s internal
cancellation flag, giving the caller full control over when to stop.
Sourcepub fn multi_grep(
&self,
patterns: &[&str],
constraints: &[Constraint<'_>],
options: &GrepSearchOptions,
) -> GrepResult<'_>
pub fn multi_grep( &self, patterns: &[&str], constraints: &[Constraint<'_>], options: &GrepSearchOptions, ) -> GrepResult<'_>
Multi-pattern grep search across indexed files.
pub fn get_scan_progress(&self) -> ScanProgress
pub fn update_single_file_frecency( &mut self, file_path: impl AsRef<Path>, frecency_tracker: &FrecencyTracker, ) -> Result<(), Error>
pub fn get_file_by_path(&self, path: impl AsRef<Path>) -> Option<&FileItem>
pub fn get_mut_file_by_path( &mut self, path: impl AsRef<Path>, ) -> Option<&mut FileItem>
Sourcepub fn handle_create_or_modify(
&mut self,
path: impl AsRef<Path> + Debug,
) -> Option<&FileItem>
pub fn handle_create_or_modify( &mut self, path: impl AsRef<Path> + Debug, ) -> Option<&FileItem>
Handle the event of certain file being modified or adds a neww file if it is not added
If this function returns None it means that picker is in the invalid state, or the capacity
of index is exhausted and a new rescan needs to be triggered.
Sourcepub fn add_new_file(&mut self, path: &Path) -> Option<&FileItem>
pub fn add_new_file(&mut self, path: &Path) -> Option<&FileItem>
Adds a new file to picker, if the file can not be added returns None
which indicates that it’s time to trigger a new sync
Sourcepub fn remove_file_by_path(&mut self, path: impl AsRef<Path>) -> bool
pub fn remove_file_by_path(&mut self, path: impl AsRef<Path>) -> bool
Tombstone a file instead of removing it, keeping base indices stable.
pub fn remove_all_files_in_dir(&mut self, dir: impl AsRef<Path>) -> usize
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Use this to prevent any substantial background threads from acquiring the locks
Sourcepub fn stop_background_monitor(&mut self)
pub fn stop_background_monitor(&mut self)
Stop the background filesystem watcher. Non-blocking.
Sourcepub fn is_scan_active(&self) -> bool
pub fn is_scan_active(&self) -> bool
Quick way to check if scan is going without acquiring a lock for Self::get_scan_progress
Sourcepub fn watcher_signal(&self) -> Arc<AtomicBool>
pub fn watcher_signal(&self) -> Arc<AtomicBool>
Return a clone of the watcher-ready flag so callers can poll it without holding a lock on the picker.
Trait Implementations§
Source§impl Debug for FilePicker
impl Debug for FilePicker
Source§impl FfsStringStorage for &FilePicker
impl FfsStringStorage for &FilePicker
Auto Trait Implementations§
impl Freeze for FilePicker
impl !RefUnwindSafe for FilePicker
impl Send for FilePicker
impl Sync for FilePicker
impl Unpin for FilePicker
impl UnsafeUnpin for FilePicker
impl !UnwindSafe for FilePicker
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> 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