Comments (4)
Before I answer, first a clarification: inotify-rs is just a wrapper around Linux's inotify API, and it doesn't really do a whole lot on top of that. Therefore what you describe is not a behavior of inotify-rs, but of inotify itself.
I can't speak to the intended usage, but I think it's unnecessary to create one Inotify
instance per directory. You should be able to distinguish the events using the WatchDescriptor
returned by the add_watch
method. Event
's field wd
is a WatchDescriptor
too, so you can use that to keep track of the various watches you added.
I'm going to close this issue, as I've answered the question. Feel free to post more comments though, if you have more questions, and feel free to reopen the issue if you believe there's something in inotify-rs that needs to be changed.
from inotify-rs.
I'd like to add that there are known bugs in the version on crates.io (0.4.1), that have been fixed but not published. One of the bugs (see #60) is specific to WatchDescriptor
and can potentially break your application. I suggest linking the dependency to the repository in your cargo.toml like so:
inotify = { git = "https://github.com/hannobraun/inotify-rs.git", branch = "master" }
The master branch has breaking changes, and some of the documentation needs to be updated to reflect that. Be aware that there are still bugs that need fixing.
Reading the Inotify man pages will be of great help. Inotify has it's quirks and it only helps to be aware of them when implementing the library.
from inotify-rs.
Thank you for the answers, I ended up going with the notify wrapper over this since it seems to implement all the functionality I need in a (hopefully reasonably fast) way.
I will however use the github rolling release style dependency with that one, since it probably uses 0.4.1 itself.
from inotify-rs.
I think notify is the right choice for most uses cases. It's a bit behind with its depdency on inotify-rs though, it still depends on 0.3.0.
from inotify-rs.
Related Issues (20)
- Cutting a release for #171 and #173 HOT 1
- Consider addressing buffer alignment in a more robust way HOT 2
- `Inotify::event_stream` is error-prone HOT 2
- Add separate API for adding/removing watches
- Implement ToOwned for `Event<&'a OsStr>` HOT 9
- Consider using cargo clippy in test workflows HOT 1
- Consider increasing the buffer size for the stream example HOT 2
- Using Inotify::read_events in async context HOT 3
- Is it possible to get full path from Event? HOT 3
- Update minimum supported Rust version HOT 1
- duplicate event reports HOT 9
- Async runtime agnostic. HOT 2
- Bump MSRV to at least 1.56 HOT 1
- documentation for `Inotify::watches` is broken in 0.10.1 HOT 4
- Invalid argument when trying to monitor /dev/snd HOT 2
- Update dependency `bitflags` to v2? HOT 3
- docs.rs links from inotify to inotify_sys are broken HOT 4
- Fail CI build on doc warnings
- Example in API reference is broken HOT 7
- Recursive Directory Watching HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inotify-rs.