BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.22k stars 107 forks source link

Extended documentation to include Errors section #68

Closed AndyGauge closed 7 years ago

AndyGauge commented 7 years ago

for Iter (Iterator::next()), FilterEntry (Iterator::next()), and DirEntry::metadata()

For #24

AndyGauge commented 7 years ago

For Iterator::next(), I'm not sure if Errors need to be publicly part of the API because the Error case that I can see (calling unwrap() on a None) should be handled by calling is_empty() on the stack_list. Because the stack_list is not empty, last_mut() should always return a value and therefore the error should probably be handled within the method. (Andy's 2 cents)

brson commented 7 years ago

ping @BurntSushi

BurntSushi commented 7 years ago

For Iterator::next(), I'm not sure if Errors need to be publicly part of the API because the Error case that I can see (calling unwrap() on a None) should be handled by calling is_empty() on the stack_list. Because the stack_list is not empty, last_mut() should always return a value and therefore the error should probably be handled within the method. (Andy's 2 cents)

I don't think I understand this. The error isn't something that walkdir itself can handle. All it can do is pass it along to the caller so that they can handle it.

Otherwise, this PR looks great. Thanks @AndyGauge!