Skip to main content

FilePicker

Struct FilePicker 

Source
pub struct FilePicker { /* private fields */ }

Implementations§

Source§

impl FilePicker

Source

pub fn base_path(&self) -> &Path

Source

pub fn warmup_mmap_cache(&self) -> bool

Source

pub fn mode(&self) -> FFFMode

Source

pub fn git_root(&self) -> Option<&Path>

Source

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.

Source

pub fn new_with_shared_state( base_path: String, warmup_mmap_cache: bool, mode: FFFMode, shared_picker: SharedPicker, shared_frecency: SharedFrecency, ) -> Result<(), Error>

Create a new FilePicker and place it into the provided shared handle.

The background scan thread and file-system watcher write into the provided SharedPicker and read frecency data from the provided SharedFrecency.

Multiple independent instances can coexist in the same process.

Perform fuzzy search on files with a pre-parsed query.

The query should be parsed using QueryParser::parse() before calling this function. This allows the caller to handle location parsing and other preprocessing.

§Arguments
  • files - Slice of files to search
  • query - The raw query string (used for max_typos calculation and debugging)
  • parsed - Pre-parsed query result (can be None for simple single-token queries)
  • options - Search options including pagination, threading, and scoring parameters
§Returns

SearchResult containing matched files, scores, and location information

Source

pub fn get_scan_progress(&self) -> ScanProgress

Source

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.

Source

pub fn refresh_git_status( shared_picker: &SharedPicker, shared_frecency: &SharedFrecency, ) -> Result<usize, Error>

Refreshes git statuses using the provided shared picker and frecency handles.

Source

pub fn update_single_file_frecency( &mut self, file_path: impl AsRef<Path>, frecency_tracker: &FrecencyTracker, ) -> Result<(), Error>

Source

pub fn get_file_by_path(&self, path: impl AsRef<Path>) -> Option<&FileItem>

Source

pub fn get_mut_file_by_path( &mut self, path: impl AsRef<Path>, ) -> Option<&mut FileItem>

Source

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)

Source

pub fn on_create_or_modify( &mut self, path: impl AsRef<Path> + Debug, ) -> Option<&FileItem>

Source

pub fn remove_file_by_path(&mut self, path: impl AsRef<Path>) -> bool

Source

pub fn remove_all_files_in_dir(&mut self, dir: impl AsRef<Path>) -> usize

Source

pub fn cancel(&self)

We use this to prevent any substantial background threads from acquiring the locks

Source

pub fn stop_background_monitor(&mut self)

Source

pub fn trigger_rescan( &mut self, shared_frecency: &SharedFrecency, ) -> Result<(), Error>

Source

pub fn is_scan_active(&self) -> bool

Source

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.

Trait Implementations§

Source§

impl Debug for FilePicker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,