Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This also requires an updated inotify-rs which you can find in this branch (see the PR). It basically uses the new
std::io
for errors. You can use it like this:So
Path
is tostr
asPathBuf
is toString
, as I'm sure you already know. So things that containedPath
s, likeHashMaps
, now containPathBuf
s.One consequence of updating the inotify-rs package to use the new
std::io
is that there is no longer anEndOfFile
variant ofErrorKind
. Instead,read
returns a0
on EOF. I'm not sure exactly what should be done in this case, in the context of inotify, so in my inotify-rs branch I just returned an empty slice. This may change if you guys decide there's something else that should be done instead. Read the PR for more information.One problem right now is that we forgot to implement
Hash
forPath
; it's only implemented forPathBuf
. This means that if you want to perform operations on a hashmap that containsPathBuf
keys, but you only have a&Path
, you have to convert it to aPathBuf
in order to index the hashmap. I filed a PR for this for rust, and for now added FIXME comments so we can remember to change this when it lands.One slightly tedious change is that
fs::walk_dir
now returns an iterator that itself yieldsResult
s. If the result isOk
, it yields aDirEntry
type which you callpath()
on to get the actual Path.As with my inotify-rs PR, I updated this to use the new
std::io::Error
instead ofIoError
.Now, instead of
lstat()
, we use themetadata()
method which has amodified()
method which we can use.