Skip to main content

TraversalFilter

Trait TraversalFilter 

Source
pub trait TraversalFilter: Send + Sync {
    // Required methods
    fn should_descend(&self, path: &Path, config: &SimpleIndexerConfig) -> bool;
    fn should_index_file(
        &self,
        path: &Path,
        config: &SimpleIndexerConfig,
    ) -> bool;

    // Provided method
    fn should_index_file_with_metadata(
        &self,
        path: &Path,
        metadata: &Metadata,
        config: &SimpleIndexerConfig,
    ) -> bool { ... }
}
Expand description

Directory traversal filter hook for SimpleIndexer.

Required Methods§

Source

fn should_descend(&self, path: &Path, config: &SimpleIndexerConfig) -> bool

Determine if the indexer should descend into the provided directory.

Source

fn should_index_file(&self, path: &Path, config: &SimpleIndexerConfig) -> bool

Determine if the indexer should process the provided file.

Provided Methods§

Source

fn should_index_file_with_metadata( &self, path: &Path, metadata: &Metadata, config: &SimpleIndexerConfig, ) -> bool

Metadata-aware variant of TraversalFilter::should_index_file.

The default implementation delegates to TraversalFilter::should_index_file, so existing filters keep their exact behavior. Filters whose file check starts with an existence test should override this to reuse metadata instead of stat-ing the path a second time.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§