Skip to main content

grep_directory

Function grep_directory 

Source
pub fn grep_directory(
    path: &Path,
    re: &Regex,
    base: Option<&Path>,
    include: Option<&str>,
    skip_dirs: &[&str],
    max_matches: usize,
) -> Result<(Vec<GrepMatch>, usize)>
Expand description

递归 grep 目录,返回匹配行

  • base: 用于生成相对路径的基准,若为 None 则使用完整路径
  • include: 可选 glob,如 “*.rs” 仅匹配扩展名
  • skip_dirs: 跳过的目录名,默认用 SKIP_DIRS
  • max_matches: 最大匹配数