在rust语言中,要想查找文件或路径,可以使用walkdir和glob这两个库来完成。
	然而,这两个库的性能却有明显的差异。首先看这两个库的代码。
	①glob代码
	fn myglob(){
 	   let mut c = 0;
  	  let options = MatchOptions {
   	     case_sensitive: false,
    	    require_literal_separator: false,
      	  require_literal_leading_dot: false,
   	 };
   	 for entry in glob_with("c:/**/*.txt", options).unwrap() {
   	     if let Ok(path) = entry {
      	      println!("{:?}", path.display());
       	     c +=1;
      	  }
   	 }
  	  println!("一共找到{}个文件", c);
	}
	②walkdir代码
	fn mywalkdir(){
		let mut c = 0;
		WalkDir::new("c:/").into_iter().filter_map(|e| e.ok()).filter(|e|e.file_type().is_file()).for_each(|e|{
			let filetype =[".txt"];
    	    	if filetype.iter().any(|x|
       	     		e.path().display().to_string().to_ascii_uppercase().ends_with(x.to_ascii_uppercase().as_str()))
         	   	&& !e.path().display().to_string().contains("$"){
           	 	println!("文件路径:{}", e.path().display());
           	 	c +=1;
       	 		}
   	 	});
   	 	println!("一共找到{}个文件", c);
	}
	上述的两种库和对应的代码,扫描C盘下所有的txt文件,都扫描到4173个文件,但是glob用了404秒,但是walkdir只使用了23秒,显然,后者性能更好速度更快。