filter_projects

Function filter_projects 

Source
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 filter
  • filter_opts - Filtering options containing size and time criteria

§Returns

  • Ok(Vec<Project>) - Filtered list of projects that meet all criteria
  • Err(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_size cannot 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)?;