pub fn apply_include_patterns<T, F>(
items: &mut Vec<T>,
patterns: &[String],
get_path: F,
)Expand description
Apply include patterns to a collection
Keeps only items whose paths match at least one include pattern.
Uses a generic get_path function to extract the path from each item.
§Arguments
items- Mutable reference to collection to filterpatterns- List of include patternsget_path- Function to extract path from an item
§Type Parameters
T- Type of items in the collectionF- Type of the path extraction function
§Examples
use infiniloom_engine::filtering::apply_include_patterns;
use infiniloom_engine::types::RepoFile;
let mut files: Vec<RepoFile> = vec![/* ... */];
let include = vec!["*.rs".to_string(), "*.ts".to_string()];
apply_include_patterns(&mut files, &include, |f| &f.relative_path);