pub struct EventListener<T, E> {
id: EventListenerID,
recv_chan: Receiver<Event>,
event_emitter: Weak<EventEmitter<T>>,
event_id: String,
topic: T,
phantom: PhantomData<E>,
}
Expand description
EventListener listens for and receives events from the EventEmitter
.
Fields§
§id: EventListenerID
§recv_chan: Receiver<Event>
§event_emitter: Weak<EventEmitter<T>>
§event_id: String
§topic: T
§phantom: PhantomData<E>
Implementations§
Source§impl<T, E> EventListener<T, E>
impl<T, E> EventListener<T, E>
Sourcefn new(
id: EventListenerID,
event_emitter: Weak<EventEmitter<T>>,
recv_chan: Receiver<Event>,
event_id: &str,
topic: &T,
) -> EventListener<T, E>
fn new( id: EventListenerID, event_emitter: Weak<EventEmitter<T>>, recv_chan: Receiver<Event>, event_id: &str, topic: &T, ) -> EventListener<T, E>
Creates a new EventListener
.
Sourcepub async fn cancel(&self)
pub async fn cancel(&self)
Cancels the event listener and removes it from the EventEmitter
.
Auto Trait Implementations§
impl<T, E> Freeze for EventListener<T, E>where
T: Freeze,
impl<T, E> !RefUnwindSafe for EventListener<T, E>
impl<T, E> Send for EventListener<T, E>
impl<T, E> Sync for EventListener<T, E>
impl<T, E> !Unpin for EventListener<T, E>
impl<T, E> !UnwindSafe for EventListener<T, E>
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