Use walkdir::WalkDir::new() to create an iterator over files and directories, then chain .into_iter() and .map() to process each entry.
use walkdir::WalkDir;
for entry in WalkDir::new("src")
.min_depth(1)
.into_iter()
.filter_map(|e| e.ok())
{
if entry.path().extension().map_or(false, |ext| ext == "md") {
println!("Found: {}", entry.path().display());
}
}
This code traverses the src directory, skips the root, and prints paths of .md files, matching the logic in lfp.rs.