diff --git a/src/files.rs b/src/files.rs index ac19772..1e04b47 100644 --- a/src/files.rs +++ b/src/files.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use crate::bytes; -pub fn from_path(path: &str) -> io::Result { +pub fn walk_dir(path: &str) -> io::Result { let dir = std::fs::read_dir(path)?; Ok(FileIter { stack: vec![dir] }) } diff --git a/src/lib.rs b/src/lib.rs index b14c209..f9e40b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,7 +24,7 @@ use files::File; /// ``` pub fn find_top_n_largest_files(path: &str, n: usize) -> io::Result> { let mut results = BTreeMap::new(); - for file in files::from_path(path)? { + for file in files::walk_dir(path)? { results.insert(file.clone(), file); } Ok(results.into_values().rev().take(n).collect())