pub struct EventStream<T: 'static> { /* private fields */ }Expand description
A simple multi-cast event stream.
Listeners are called synchronously when emit() is invoked.
Clone-safe — cloning shares the underlying listener list.
Implementations§
Source§impl<T: 'static> EventStream<T>
impl<T: 'static> EventStream<T>
pub fn new() -> Self
Sourcepub fn on<F>(&self, listener: F) -> EventSubscription
pub fn on<F>(&self, listener: F) -> EventSubscription
Subscribe to events. Returns an EventSubscription that unsubscribes on drop.
Sourcepub fn listener_count(&self) -> usize
pub fn listener_count(&self) -> usize
Returns the number of active listeners.
Trait Implementations§
Source§impl<T: 'static> Clone for EventStream<T>
impl<T: 'static> Clone for EventStream<T>
Auto Trait Implementations§
impl<T> Freeze for EventStream<T>
impl<T> RefUnwindSafe for EventStream<T>
impl<T> Send for EventStream<T>
impl<T> Sync for EventStream<T>
impl<T> Unpin for EventStream<T>
impl<T> UnsafeUnpin for EventStream<T>
impl<T> UnwindSafe for EventStream<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more