pub fn filter_projects(
projects: Vec<Project>,
filter_opts: &FilterOptions,
) -> Result<Vec<Project>>Expand description
Filter projects based on size and modification time criteria.
This function applies parallel filtering to remove projects that don’t meet the specified criteria:
- Projects smaller than the minimum size threshold
- Projects modified more recently than the specified number of days
§Arguments
projects- Vector of projects to filterfilter_opts- Filtering options containing size and time criteria
§Returns
Ok(Vec<Project>)- Filtered list of projects that meet all criteriaErr(anyhow::Error)- If size parsing fails, or file system errors occur
§Errors
This function can return errors if:
- The size string in
filter_opts.keep_sizecannot be parsed (invalid format) - Size value overflow occurs during parsing
§Examples
let filter_opts = FilterOptions {
keep_size: "100MB".to_string(),
keep_days: 30,
};
let filtered = filter_projects(projects, &filter_opts)?;