From eefbadd0b89c165aa610aa7826f110fcdae6bc89 Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Sat, 17 Aug 2024 07:23:06 -0700 Subject: [PATCH 1/2] add feature --- Cargo.toml | 17 ++++++++++------- src/future.rs | 4 ++-- src/lib.rs | 4 ++-- src/stream.rs | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 176b4be..2458159 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,21 @@ [package] -name = "debounced" +name = "debounced-wasm" version = "0.1.0" edition = "2021" license = "MIT" -description = "Utility for building delayed `Future`s and debounced `Stream`s that wait a given duration before yielding the most recent item." +description = "A fork of the debounced crate that works with wasm" documentation = "https://docs.rs/debounced/" homepage = "https://github.com/glacyr/debounced" repository = "https://github.com/glacyr/debounced" +[features] +wasm-bindgen = ["futures-timer/wasm-bindgen"] + [dependencies] -futures-timer = "3.0.2" -futures-util = { version = "0.3.25", default-features = false, features = ["sink"] } +futures-timer = "3.0.3" +futures-util = { version = "0.3.30", default-features = false, features = ["sink"] } [dev-dependencies] -futures-channel = { version = "0.3.25", features = ["sink"] } -tokio = { version = "1.22.0", features = ["full", "test-util"] } -tokio-test = "0.4.2" +futures-channel = { version = "0.3.30", features = ["sink"] } +tokio = { version = "1.39.2", features = ["full", "test-util"] } +tokio-test = "0.4.4" diff --git a/src/future.rs b/src/future.rs index 0a372c6..430a948 100644 --- a/src/future.rs +++ b/src/future.rs @@ -11,7 +11,7 @@ use futures_util::FutureExt; /// ```rust /// # use std::time::{Duration, Instant}; /// # tokio_test::block_on(async { -/// use debounced::Delayed; +/// use debounced_wasm::Delayed; /// /// let start = Instant::now(); /// let delayed = Delayed::new(42, Duration::from_secs(1)).await; @@ -54,7 +54,7 @@ impl Future for Delayed { /// ```rust /// # use std::time::{Duration, Instant}; /// # tokio_test::block_on(async { -/// use debounced::delayed; +/// use debounced_wasm::delayed; /// /// let start = Instant::now(); /// let delayed = delayed(42, Duration::from_secs(1)).await; diff --git a/src/lib.rs b/src/lib.rs index 93d15d6..ca3d04a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,7 @@ //! ```rust //! # use std::time::{Duration, Instant}; //! # tokio_test::block_on(async { -//! use debounced::delayed; +//! use debounced_wasm::delayed; //! //! # let start = Instant::now(); //! let delayed = delayed(42, Duration::from_secs(1)).await; @@ -30,7 +30,7 @@ //! # use std::time::{Duration, Instant}; //! # use futures_util::{SinkExt, StreamExt}; //! # tokio_test::block_on(async { -//! use debounced::debounced; +//! use debounced_wasm::debounced; //! //! # let start = Instant::now(); //! let (mut sender, receiver) = futures_channel::mpsc::channel(1024); diff --git a/src/stream.rs b/src/stream.rs index 05a9a68..ee556c8 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -13,7 +13,7 @@ use super::{delayed, Delayed}; /// # use std::time::{Duration, Instant}; /// # use futures_util::{SinkExt, StreamExt}; /// # tokio_test::block_on(async { -/// use debounced::Debounced; +/// use debounced_wasm::Debounced; /// /// # let start = Instant::now(); /// let (mut sender, receiver) = futures_channel::mpsc::channel(1024); @@ -88,7 +88,7 @@ where /// # use std::time::{Duration, Instant}; /// # use futures_util::{SinkExt, StreamExt}; /// # tokio_test::block_on(async { -/// use debounced::debounced; +/// use debounced_wasm::debounced; /// /// # let start = Instant::now(); /// let (mut sender, receiver) = futures_channel::mpsc::channel(1024); From d33dbb5e17d18c1d24bb3e1df6b37d346145a991 Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Sat, 17 Aug 2024 07:24:23 -0700 Subject: [PATCH 2/2] revert forked bits --- Cargo.toml | 14 +++++++------- src/future.rs | 4 ++-- src/lib.rs | 4 ++-- src/stream.rs | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2458159..5dcc283 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "debounced-wasm" +name = "debounced" version = "0.1.0" edition = "2021" license = "MIT" -description = "A fork of the debounced crate that works with wasm" +description = "Utility for building delayed `Future`s and debounced `Stream`s that wait a given duration before yielding the most recent item." documentation = "https://docs.rs/debounced/" homepage = "https://github.com/glacyr/debounced" repository = "https://github.com/glacyr/debounced" @@ -12,10 +12,10 @@ repository = "https://github.com/glacyr/debounced" wasm-bindgen = ["futures-timer/wasm-bindgen"] [dependencies] -futures-timer = "3.0.3" -futures-util = { version = "0.3.30", default-features = false, features = ["sink"] } +futures-timer = "3.0.2" +futures-util = { version = "0.3.25", default-features = false, features = ["sink"] } [dev-dependencies] -futures-channel = { version = "0.3.30", features = ["sink"] } -tokio = { version = "1.39.2", features = ["full", "test-util"] } -tokio-test = "0.4.4" +futures-channel = { version = "0.3.25", features = ["sink"] } +tokio = { version = "1.22.0", features = ["full", "test-util"] } +tokio-test = "0.4.2" diff --git a/src/future.rs b/src/future.rs index 430a948..0a372c6 100644 --- a/src/future.rs +++ b/src/future.rs @@ -11,7 +11,7 @@ use futures_util::FutureExt; /// ```rust /// # use std::time::{Duration, Instant}; /// # tokio_test::block_on(async { -/// use debounced_wasm::Delayed; +/// use debounced::Delayed; /// /// let start = Instant::now(); /// let delayed = Delayed::new(42, Duration::from_secs(1)).await; @@ -54,7 +54,7 @@ impl Future for Delayed { /// ```rust /// # use std::time::{Duration, Instant}; /// # tokio_test::block_on(async { -/// use debounced_wasm::delayed; +/// use debounced::delayed; /// /// let start = Instant::now(); /// let delayed = delayed(42, Duration::from_secs(1)).await; diff --git a/src/lib.rs b/src/lib.rs index ca3d04a..93d15d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,7 @@ //! ```rust //! # use std::time::{Duration, Instant}; //! # tokio_test::block_on(async { -//! use debounced_wasm::delayed; +//! use debounced::delayed; //! //! # let start = Instant::now(); //! let delayed = delayed(42, Duration::from_secs(1)).await; @@ -30,7 +30,7 @@ //! # use std::time::{Duration, Instant}; //! # use futures_util::{SinkExt, StreamExt}; //! # tokio_test::block_on(async { -//! use debounced_wasm::debounced; +//! use debounced::debounced; //! //! # let start = Instant::now(); //! let (mut sender, receiver) = futures_channel::mpsc::channel(1024); diff --git a/src/stream.rs b/src/stream.rs index ee556c8..05a9a68 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -13,7 +13,7 @@ use super::{delayed, Delayed}; /// # use std::time::{Duration, Instant}; /// # use futures_util::{SinkExt, StreamExt}; /// # tokio_test::block_on(async { -/// use debounced_wasm::Debounced; +/// use debounced::Debounced; /// /// # let start = Instant::now(); /// let (mut sender, receiver) = futures_channel::mpsc::channel(1024); @@ -88,7 +88,7 @@ where /// # use std::time::{Duration, Instant}; /// # use futures_util::{SinkExt, StreamExt}; /// # tokio_test::block_on(async { -/// use debounced_wasm::debounced; +/// use debounced::debounced; /// /// # let start = Instant::now(); /// let (mut sender, receiver) = futures_channel::mpsc::channel(1024);