Conversation
This changes the `Watcher` trait to be object safe, which allows users to dynamically select which backend to use. This can be helpful on systems that support multiple file watching systems that have different tradeoffs. For example, Chromium's file watcher on OS X will use an fsevent backend when watching recursive directories, and a kqueues backend when not. In order to implement this, this makes a few changes to Watcher: * removes `new_immediate` constructor. * removes the `<P: AsRef<Path>>` from the `watch` and `unwatch`. This then replaces (and renames) calls with `notify::recommended_watcher()` to get similar behavior as the old constructor.
|
I think |
Correct, object safe traits can't have generic parameters. It's unfortunate to have to manually pass in |
0xpr03
left a comment
There was a problem hiding this comment.
Note that you currently seem to have syntax errors according to CI.
Should be fixed now! |
|
Thanks, this will be a good step towards a possible dynamic runtime change, which was in the never released -next branch |
|
Note: we may want to document and test for this, so it isn't reverted later on with a trait under the impression of usability improvements |
|
Thanks!
I did add a simple test for this in src/lib.rs, where I assert that the |
|
Ah yeah, had to test but that's already enough to verify it. Then I'll only have to add some docs later on for a more in-depth changelog |
Notion of "immediate mode" was removed in notify-rs#336.
Notion of "immediate mode" was removed in notify-rs#336.
Notion of "immediate mode" was removed in #336.
This changes the
Watchertrait to be object safe, which allows users todynamically select which backend to use. This can be helpful on systems that
support multiple file watching systems that have different tradeoffs. For
example, Chromium's file watcher on OS X will use an fsevent backend
when watching recursive directories, and a kqueues backend when not.
In order to implement this, this makes a few changes to Watcher:
new_immediateconstructor.<P: AsRef<Path>>from thewatchandunwatch.This then replaces (and renames) calls with
notify::recommended_watcher()to get similar behavior as the old constructor.