Skip to content

Commit

Permalink
uprev notify to 5.0.0-pre.16 (#182)
Browse files Browse the repository at this point in the history
* uprev notify to 5.0.0-pre.16

* fix use of config
  • Loading branch information
samuelcolvin authored Aug 14, 2022
1 parent 6636d3d commit 50eb31d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
crossbeam-channel = "0.5.4"
notify = "=5.0.0-pre.15"
notify = "=5.0.0-pre.16"
pyo3 = {version = "0.16.4", features = ["extension-module", "abi3-py37"]}

[lib]
Expand Down
14 changes: 6 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use pyo3::exceptions::{PyFileNotFoundError, PyRuntimeError, PyTypeError};
use pyo3::prelude::*;

use notify::event::{Event, EventKind, ModifyKind, RenameMode};
use notify::poll::PollWatcherConfig;
use notify::{ErrorKind, PollWatcher, RecommendedWatcher, RecursiveMode, Result as NotifyResult, Watcher};
use notify::{
Config as NotifyConfig, ErrorKind, PollWatcher, RecommendedWatcher, RecursiveMode, Result as NotifyResult, Watcher,
};

create_exception!(
_rust_notify,
Expand Down Expand Up @@ -134,11 +135,8 @@ impl RustNotify {
macro_rules! create_poll_watcher {
($msg_template:literal) => {{
let delay = Duration::from_millis(poll_delay_ms);
let config = PollWatcherConfig {
poll_interval: delay,
compare_contents: false,
};
let mut watcher = match PollWatcher::with_config(event_handler, config) {
let config = NotifyConfig::default().with_poll_interval(delay);
let mut watcher = match PollWatcher::new(event_handler, config) {
Ok(watcher) => watcher,
Err(e) => return wf_error!($msg_template, e),
};
Expand All @@ -150,7 +148,7 @@ impl RustNotify {
let watcher: WatcherEnum = match force_polling {
true => create_poll_watcher!("Error creating poll watcher: {}"),
false => {
match RecommendedWatcher::new(event_handler.clone()) {
match RecommendedWatcher::new(event_handler.clone(), NotifyConfig::default()) {
Ok(watcher) => {
let mut watcher = watcher;
watcher_paths!(watcher, watch_paths, debug);
Expand Down

0 comments on commit 50eb31d

Please sign in to comment.