pub struct FilePicker {
pub mode: FFFMode,
pub base_path: PathBuf,
pub is_scanning: Arc<AtomicBool>,
/* private fields */
}Fields§
§mode: FFFMode§base_path: PathBuf§is_scanning: Arc<AtomicBool>Implementations§
Source§impl FilePicker
impl FilePicker
pub fn base_path(&self) -> &Path
pub fn need_enable_mmap_cache(&self) -> bool
pub fn need_enable_content_indexing(&self) -> bool
pub fn need_watch(&self) -> bool
pub fn mode(&self) -> FFFMode
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>
pub fn set_bigram_index(&mut self, index: BigramFilter, overlay: BigramOverlay)
pub fn git_root(&self) -> Option<&Path>
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 extract_watch_dirs(&self) -> Vec<PathBuf>
pub fn extract_watch_dirs(&self) -> Vec<PathBuf>
Extracts all unique ancestor directories from the indexed file list. Uses the pre-built directory table when available (O(d) where d = unique dirs), falling back to the old traversal for overflow files.
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: &SharedPicker,
shared_frecency: &SharedFrecency,
) -> Result<(), Error>
pub fn spawn_background_watcher( &mut self, shared_picker: &SharedPicker, 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 FFFQuery<'q>,
query_tracker: Option<&QueryTracker>,
options: FuzzySearchOptions<'q>,
) -> SearchResult<'_>
pub fn fuzzy_search<'q>( &self, query: &'q FFFQuery<'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 FFFQuery::parse() before calling
this function. If a QueryTracker is provided, the search will
automatically look up the last selected file for this query and apply
combo-boost scoring.
Sourcepub fn fuzzy_search_directories<'q>(
&self,
query: &'q FFFQuery<'q>,
options: FuzzySearchOptions<'q>,
) -> DirSearchResult<'_>
pub fn fuzzy_search_directories<'q>( &self, query: &'q FFFQuery<'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 FFFQuery<'q>,
query_tracker: Option<&QueryTracker>,
options: FuzzySearchOptions<'q>,
) -> MixedSearchResult<'_>
pub fn fuzzy_search_mixed<'q>( &self, query: &'q FFFQuery<'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: &FFFQuery<'_>,
options: &GrepSearchOptions,
) -> GrepResult<'_>
pub fn grep( &self, query: &FFFQuery<'_>, 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.
Sourcepub fn grep_without_overlay(
&self,
query: &FFFQuery<'_>,
options: &GrepSearchOptions,
) -> GrepResult<'_>
pub fn grep_without_overlay( &self, query: &FFFQuery<'_>, options: &GrepSearchOptions, ) -> GrepResult<'_>
Like grep but ignores the bigram overlay.
pub fn get_scan_progress(&self) -> ScanProgress
Sourcepub fn update_git_statuses(
&mut self,
status_cache: GitStatusCache,
shared_frecency: &SharedFrecency,
) -> Result<(), Error>
pub fn update_git_statuses( &mut self, status_cache: GitStatusCache, shared_frecency: &SharedFrecency, ) -> Result<(), Error>
Update git statuses for files, using the provided shared frecency tracker.
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 add_file_sorted(&mut self, file: FileItem) -> Option<&FileItem>
pub fn add_file_sorted(&mut self, file: FileItem) -> Option<&FileItem>
Add a file to the picker’s files in sorted order (used by background watcher)
pub fn on_create_or_modify( &mut self, path: impl AsRef<Path> + Debug, ) -> Option<&FileItem>
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
pub fn stop_background_monitor(&mut self)
pub fn trigger_rescan( &mut self, shared_frecency: &SharedFrecency, ) -> Result<(), Error>
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 scan_signal(&self) -> Arc<AtomicBool>
pub fn scan_signal(&self) -> Arc<AtomicBool>
Return a clone of the scanning flag so callers can poll it without holding a lock on the picker.
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 FFFStringStorage for &FilePicker
impl FFFStringStorage 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