diff --git a/packages/time/src/debounce.rs b/packages/time/src/debounce.rs index 1e2ed66..ec3f47e 100644 --- a/packages/time/src/debounce.rs +++ b/packages/time/src/debounce.rs @@ -9,7 +9,6 @@ use std::time::Duration; /// The interface for calling a debounce. /// /// See [`use_debounce`] for more information. -#[derive(Clone, Copy, PartialEq)] pub struct UseDebounce { current_handle: Signal>, timeout: UseTimeout, @@ -30,6 +29,18 @@ impl UseDebounce { } } +impl Clone for UseDebounce { + fn clone(&self) -> Self { + *self + } +} +impl Copy for UseDebounce {} +impl PartialEq for UseDebounce { + fn eq(&self, other: &Self) -> bool { + self.current_handle == other.current_handle && self.timeout == other.timeout + } +} + /// A hook for allowing a function to be called only after a provided [`Duration`] has passed. /// /// Once the [`UseDebounce::action`] method is called, a timer will start counting down until @@ -48,7 +59,7 @@ impl UseDebounce { /// // Create a two second debounce. /// // This will print "ran" after two seconds since the last action call. /// let mut debounce = use_debounce(Duration::from_secs(2), |_| println!("ran")); -/// +/// /// rsx! { /// button { /// onclick: move |_| { @@ -71,7 +82,7 @@ impl UseDebounce { /// #[component] /// fn App() -> Element { /// let mut debounce = use_debounce(Duration::from_secs(5), |_| println!("ran")); -/// +/// /// rsx! { /// button { /// // Start the debounce on click. @@ -102,7 +113,7 @@ impl UseDebounce { /// tokio::time::sleep(Duration::from_secs(2)).await; /// println!("after async"); /// }); -/// +/// /// rsx! { /// button { /// onclick: move |_| {