File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,26 @@ impl<T> Event<T> {
205
205
}
206
206
}
207
207
208
+ /// Tell whether any listeners are currently notified.
209
+ ///
210
+ /// # Examples
211
+ ///
212
+ /// ```
213
+ /// use event_listener::Event;
214
+ ///
215
+ /// let event = Event::new();
216
+ /// let listener = event.listen();
217
+ /// assert!(!event.is_notified());
218
+ ///
219
+ /// event.notify(1);
220
+ /// assert!(event.is_notified());
221
+ /// ```
222
+ #[ inline]
223
+ pub fn is_notified ( & self ) -> bool {
224
+ self . try_inner ( )
225
+ . map_or ( false , |inner| inner. notified . load ( Ordering :: Acquire ) > 0 )
226
+ }
227
+
208
228
/// Returns a guard listening for a notification.
209
229
///
210
230
/// This method emits a `SeqCst` fence after registering a listener. For now, this method
You can’t perform that action at this time.
0 commit comments