// Search a directory for pairs of indexes and tarballs
Search a directory for pairs of indexes and tarballs
Search a directory for pairs of indexes and tarballs
fn discover_indexes(dir: &Path) -> Vec<(PathBuf, PathBuf)> {
  fs::read_dir(dir)
    .map(|entries| {
      entries
        .filter_map(|entry| {
          entry.ok()
        })
        .filter_map(|entry| {
          let path = entry.path();
          if path.extension()?.to_str()? == "idx" {
            let tarball_path = path.with_extension("");
            Some((path, tarball_path))
          } else {
            None
          }
        })
        .collect()
    })
    .unwrap_or(Vec::new())
}
fn discover_indexes ( dir : & Path ) -> Vec < ( PathBuf , PathBuf ) > { fs :: read_dir ( dir ) . map ( | entries | { entries . filter_map ( | entry | { entry . ok ( ) } ) . filter_map ( | entry | { let path = entry . path ( ) ; if path . extension ( ) ? . to_str ( ) ? == " " { let tarball_path = path . with_extension ( " " ) ; Some ( ( path , tarball_path ) ) } else { None } } ) . collect ( ) } ) . unwrap_or ( Vec :: new ( ) ) }
Search a directory for pairs of indexes and tarballs
Search a directory for pairs of indexes and tarballs
dir
&Path