| Crates.io | wait-counter |
| lib.rs | wait-counter |
| version | 0.1.2 |
| created_at | 2025-03-13 16:17:38.22888+00 |
| updated_at | 2025-03-13 16:22:51.588031+00 |
| description | A counter allow you to wait, and return when it reach 1 |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1591059 |
| size | 21,831 |
let counter = WaitCounter::new();
let cloned = counter.clone();
tokio::spawn(async move {
// After simulating time-consuming operations, drop the cloned instance
tokio::time::sleep(Duration::from_millis(1000)).await;
drop(cloned);
});
counter.wait().await;
println!("Counter reached 1");