mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(tokio-util): EventListeners with Listener Management (#5136)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
committed by
GitHub
parent
fbf12de4e4
commit
36dde36479
@ -33,4 +33,14 @@ impl<T: Clone> EventListeners<T> {
|
||||
pub fn push_listener(&mut self, listener: mpsc::UnboundedSender<T>) {
|
||||
self.listeners.push(listener);
|
||||
}
|
||||
|
||||
/// Returns the number of registered listeners.
|
||||
pub fn len(&self) -> usize {
|
||||
self.listeners.len()
|
||||
}
|
||||
|
||||
/// Returns true if there are no registered listeners.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.listeners.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user