Closed nivkner closed 6 years ago
Thanks @nivkner! I like the idea of offering an io_error
method on walkdir's Error
type that returns &io::Error
. It might be a bit clearer and more compact than From::from
in cases where you just want to inspect part of the error.
What do you think?
I think it's a good idea since you probably don't want to consume the error just to check the io::Error
.
However, I did make one change: return Option<&io::Error>
since there is the case where Error
doesn't represent an I/O error but rather a cycle.
Unlike From
where you could just construct a new error, here the return value must be a borrow, where I have nothing to borrow.
Returning something new as a borrow just results in does not live long enough
error.
Fixed the PR as per @BurntSushi's review.
fixes #81