Opened an issue making a case for the inclusion of `fs::read_dir_all` in std:https://github.com/rust-lang/rust/issues/69684 …
-
Show this thread
-
-
Replying to @yoshuawuyts
create_dir_all is for when I want that bottom level directory does exist. remove_dir_all is for removing dir “unconditionally”. Only one way to do them. Traversing the hierarchy sometimes you wanna depth-first, sometimes breadth-first... and you might wanna do it in parallel...
1 reply 0 retweets 0 likes -
Replying to @ayourtch @yoshuawuyts
I suppose another way to put it is the create/delete all are 1-d in its semantics. A-then-B-then-C. Directory is inherently a 2-d operation - breadth and depth. So it “feels” different... FWIW, my two completely unsolicited cents!
1 reply 0 retweets 0 likes -
Replying to @ayourtch
Heh, no worries. You make a valid point! I think that kind of functionality would be great to have as well, but that doesn't mean this can't exist as well. There are many cases where that kind of control is simply not needed, and a shorthand function would work great!
1 reply 0 retweets 0 likes -
Replying to @yoshuawuyts
Indeed, it can be quite useful! Btw, the “2d-ness” can be probably taken care of by passing something like Option<Fn(&mut Vec<DirEntry>)> which would sort/prune the list of items that are subject to “add to result / recurse into” decision within the loop.
1 reply 0 retweets 0 likes
I just remembered https://docs.rs/walkdir/2.3.1/walkdir/ … exists, and there's a strong case for smth like this in std as well, heh. But yeah, different scope. Which is why a simple/obvious API could be a good starting point.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.