From 4115b652405e1da98590aacd8cee8bab7ebeed82 Mon Sep 17 00:00:00 2001 From: Aron Heinecke Date: Sun, 14 Aug 2022 15:09:54 +0200 Subject: [PATCH] fixup optional crossbeam feature selection in debouncer-mini remove printlns --- .github/workflows/main.yml | 5 +++++ notify-debouncer-mini/Cargo.toml | 6 ++++-- notify-debouncer-mini/README.md | 7 +++++-- notify-debouncer-mini/src/lib.rs | 10 +++++++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88b643ce..2b2ba50b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,6 +63,11 @@ jobs: run: cargo check -p notify --no-default-features --features=macos_kqueue # -p notify required for feature selection! + - name: check notify debouncer mini features + if: matrix.version == 'stable' + run: cargo check -p notify-debouncer-mini --no-default-features + # -p required for feature selection to actually work! + - name: check build examples if: matrix.version == 'stable' run: cargo check --package examples --examples diff --git a/notify-debouncer-mini/Cargo.toml b/notify-debouncer-mini/Cargo.toml index 1eb1919a..53631f3c 100644 --- a/notify-debouncer-mini/Cargo.toml +++ b/notify-debouncer-mini/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notify-debouncer-mini" -version = "0.1.1" +version = "0.1.2" edition = "2021" rust-version = "1.56" description = "notify mini debouncer for events" @@ -19,7 +19,9 @@ name = "notify_debouncer_mini" path = "src/lib.rs" [features] -default = ["crossbeam-channel"] +default = ["crossbeam"] +# can't use dep:crossbeam-channel and feature name crossbeam-channel below rust 1.60 +crossbeam = ["crossbeam-channel","notify/crossbeam-channel"] [dependencies] notify = "5.0.0-pre.16" diff --git a/notify-debouncer-mini/README.md b/notify-debouncer-mini/README.md index e59530ce..81573f0a 100644 --- a/notify-debouncer-mini/README.md +++ b/notify-debouncer-mini/README.md @@ -2,16 +2,19 @@ [![ยป Docs](https://flat.badgen.net/badge/api/docs.rs/df3600)][docs] -Tiny debouncer for [notify](https://crates.io/crates/notify). Filters incoming events and emits only one event per timeframe per file. +Tiny debouncer for [notify]. Filters incoming events and emits only one event per timeframe per file. ## Features - `crossbeam` enabled by default, for crossbeam channel support. This may create problems used in tokio environments. See [#380](https://github.com/notify-rs/notify/issues/380). +<<<<<<< HEAD Use someting like the following to disable it. ```toml notify-debouncer-mini = { version = "*", default-features = false } ``` +This also passes through to notify as `crossbeam-channel` feature. - `serde` for serde support of event types, off by default -[docs]: https://docs.rs/notify-debouncer-mini \ No newline at end of file +[docs]: https://docs.rs/notify-debouncer-mini +[notify]: https://crates.io/crates/notify \ No newline at end of file diff --git a/notify-debouncer-mini/src/lib.rs b/notify-debouncer-mini/src/lib.rs index 1fcc9950..f0caae12 100644 --- a/notify-debouncer-mini/src/lib.rs +++ b/notify-debouncer-mini/src/lib.rs @@ -6,6 +6,13 @@ //! [dependencies] //! notify-debouncer-mini = "0.1" //! ``` +//! In case you want to select specific features of notify, +//! specify notify as dependency explicitely in your dependencies. +//! Otherwise you can just use the re-export of notify from debouncer-mini. +//! ```toml +//! notify-debouncer-mini = "0.1" +//! notify = { version = "..", features = [".."] } +//! ``` //! //! # Examples //! @@ -174,10 +181,8 @@ impl DebounceDataInner { // TODO: perfect fit for drain_filter https://github.com/rust-lang/rust/issues/59618 for (k, v) in self.d.drain() { if v.update.elapsed() >= self.timeout { - println!("normal timeout"); events_expired.push(DebouncedEvent::new(k, DebouncedEventKind::Any)); } else if v.insert.elapsed() >= self.timeout { - println!("continuous"); data_back.insert(k.clone(), v); events_expired.push(DebouncedEvent::new(k, DebouncedEventKind::AnyContinuous)); } else { @@ -205,7 +210,6 @@ impl DebounceDataInner { for path in e.paths.into_iter() { if let Some(v) = self.d.get_mut(&path) { v.update = Instant::now(); - println!("Exists"); } else { self.d.insert(path, EventData::new_any()); }