Join GitHub today
File Loop app example #239
This is a rough draft of the file loop example. I'd love some feedback on how to make it more concise. Right now there's a lot of boiler plate on iterating through the file system, and check parent paths. Though, the file system boilerplate could help make a better case for walkdir. @budziq , thanks for the tip on how to make a sym link loop. Fixes #207
Hi @Ophirr33 Thanks for the PR.
As you've discovered you are reimplementing part of
walkdir I would suggest to avoid that
Here are some thoughts:
The original idea was to take a Path:
- split it into elements and just check each pair without any calls to
fs::read_diror need for a HashMap.
- please note that
PathBufalready acts as a stack implementing
- I wouldn't worry about performance optimization here. We want to show the general concept and the reader would be perfectly capable of implementing their own caching scheme - so please skip the HashMap
So with this simplified assumptions this could be made into a 4-5 liner.
Also could you:
- run rustfmt on the code after it's ready
- squash the commits into one
- rebase the PR to latest master