Use impl AsRef<Path> for the path argument to relax restrictions and be more intuitive and friendly, particularly on Windows which has paths that dont conform to utf8 and therefore cannot be put in a &str
Removed redundant code which either evaluated, always the same or could be inlined to remove function calls and improve performance
Remove redundant type annotation (because the rust type system is incredible and can deal with that for us :))
Use struct rather than function. This allows us to implement a lot more custom behaviour, for example, what I did, implement the Iterator trait so that it can be treated the same as any other iterator.
List of changes:
impl AsRef<Path>
for the path argument to relax restrictions and be more intuitive and friendly, particularly on Windows which has paths that dont conform to utf8 and therefore cannot be put in a&str
Iterator
trait so that it can be treated the same as any other iterator.