pub struct EventSource<T> { /* private fields */ }Expand description
Emits events to subscribed listeners.
Implementations§
Source§impl<T: Clone + Copy + 'static> EventSource<T>
 
impl<T: Clone + Copy + 'static> EventSource<T>
pub fn new() -> Self
Sourcepub fn add_listener(
    &mut self,
    notify_fn: impl Fn(T, &mut CallbackQueue) + Send + Sync + 'static,
) -> Handle<T>
 
pub fn add_listener( &mut self, notify_fn: impl Fn(T, &mut CallbackQueue) + Send + Sync + 'static, ) -> Handle<T>
Add a listener.
Sourcepub fn notify_listeners(&mut self, message: T, cb_queue: &mut CallbackQueue)
 
pub fn notify_listeners(&mut self, message: T, cb_queue: &mut CallbackQueue)
Notify all listeners.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for EventSource<T>
impl<T> !RefUnwindSafe for EventSource<T>
impl<T> Send for EventSource<T>
impl<T> Sync for EventSource<T>
impl<T> Unpin for EventSource<T>
impl<T> !UnwindSafe for EventSource<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
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more