1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Async manual-reset and auto-reset events for multi-use signaling.
//!
//! This crate provides two families of event primitives:
//!
//! * **Manual-reset events** ([`ManualResetEvent`], [`LocalManualResetEvent`]) — a gate
//! that, once set, releases all current and future awaiters until explicitly
//! reset via [`reset()`][ManualResetEvent::reset].
//! * **Auto-reset events** ([`AutoResetEvent`], [`LocalAutoResetEvent`]) — a token
//! dispenser that releases exactly one awaiter per
//! [`set()`][AutoResetEvent::set] call.
//!
//! Each family comes in a thread-safe variant (`Send + Sync`) and a
//! single-threaded `Local` variant for improved efficiency when thread safety
//! is not required.
//!
//! Events are lightweight cloneable handles. All clones from the same family
//! share the same underlying state.
//!
//! # Manual-reset example
//!
//! ```
//! use events::ManualResetEvent;
//!
//! #[tokio::main]
//! async fn main() {
//! let event = ManualResetEvent::boxed();
//! let setter = event.clone();
//!
//! // Producer opens the gate from a background task.
//! tokio::spawn(async move {
//! setter.set();
//! });
//!
//! // Consumer waits for the gate to open.
//! event.wait().await;
//!
//! // The gate stays open — it must be explicitly closed.
//! assert!(event.try_wait());
//! }
//! ```
//!
//! # Auto-reset example
//!
//! ```
//! use events::AutoResetEvent;
//!
//! #[tokio::main]
//! async fn main() {
//! let event = AutoResetEvent::boxed();
//! let setter = event.clone();
//!
//! // Producer signals from a background task.
//! tokio::spawn(async move {
//! setter.set();
//! });
//!
//! // Consumer waits for the signal.
//! event.wait().await;
//!
//! // Signal was consumed.
//! assert!(!event.try_wait());
//! }
//! ```
pub const NEVER_POISONED: &str = "we never panic while holding this lock";
pub use ;
pub use ;
pub use ;
pub use ;
/// Future types returned by event `wait()` methods.
///
/// These futures are `!Unpin` and must be pinned before polling.