From 4b7aec514ad4757e4271afc56032a158b629cade Mon Sep 17 00:00:00 2001 From: Al Liu Date: Sat, 9 Mar 2024 01:13:34 +0800 Subject: [PATCH] update api --- Cargo.toml | 2 +- src/future.rs | 2 +- src/lib.rs | 2 +- src/tokio.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4ab166e..9319909 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://github.com/al8n/wg" repository = "https://github.com/al8n/wg.git" documentation = "https://docs.rs/wg/" readme = "README.md" -version = "0.7.3" +version = "0.7.4" license = "MIT OR Apache-2.0" keywords = ["waitgroup", "async", "sync", "notify", "wake"] categories = ["asynchronous", "concurrency", "data-structures"] diff --git a/src/future.rs b/src/future.rs index af4572a..23eab00 100644 --- a/src/future.rs +++ b/src/future.rs @@ -162,7 +162,7 @@ impl AsyncWaitGroup { /// }); /// # }) /// ``` - pub fn done(self) { + pub fn done(&self) { if self.inner.counter.fetch_sub(1, Ordering::SeqCst) == 1 { self.inner.event.notify(usize::MAX); } diff --git a/src/lib.rs b/src/lib.rs index 78e9bd8..cd234a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -220,7 +220,7 @@ impl WaitGroup { /// }); /// /// ``` - pub fn done(self) { + pub fn done(&self) { let mut val = self.inner.count.lock_me(); *val = if val.eq(&1) { diff --git a/src/tokio.rs b/src/tokio.rs index 429044a..1ac0116 100644 --- a/src/tokio.rs +++ b/src/tokio.rs @@ -161,7 +161,7 @@ impl AsyncWaitGroup { /// }); /// } /// ``` - pub fn done(self) { + pub fn done(&self) { if self.inner.counter.fetch_sub(1, Ordering::SeqCst) == 1 { self.inner.notify.notify_waiters(); }