MCPcopy Create free account
hub / github.com/apache/datafusion / list_files

Function list_files

benchmarks/benches/sql.rs:240–259  ·  view source on GitHub ↗

Recursively walks the directory tree starting at `path` and calls the call back function for every file encountered.

(path: &str, callback: &mut F)

Source from the content-addressed store, hash-verified

238/// Recursively walks the directory tree starting at `path` and
239/// calls the call back function for every file encountered.
240pub fn list_files<F>(path: &str, callback: &mut F)
241where
242 F: FnMut(&str),
243{
244 let mut entries: Vec<fs::DirEntry> =
245 fs::read_dir(path).unwrap().filter_map(Result::ok).collect();
246 entries.sort_by_key(|entry| entry.path());
247
248 for dir_entry in entries {
249 let path = dir_entry.path();
250 if path.is_dir() {
251 // Recurse into the sub‑directory
252 list_files(&path.to_string_lossy(), callback);
253 } else {
254 // For files, invoke the callback with the full path as a string
255 let full_str = path.to_string_lossy();
256 callback(&full_str);
257 }
258 }
259}
260
261/// Loads all benchmark files in the `sql_benchmarks` directory.
262/// For each file ending with `.benchmark` it creates a new

Callers 1

load_benchmarksFunction · 0.85

Calls 3

read_dirFunction · 0.85
collectMethod · 0.80
pathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…