/// Emits an event. If the event isn't in the restricted set of allowed types, this operation
/// is a no-op. An error is returned when sending the event into the channel fails.
Emits an event. If the event isn't in the restricted set of allowed types, this operation
is a no-op. An error is returned when sending the event into the channel fails.
Emits an event . If the event isn ' t in the restricted set of allowed types this operation is a no - op . An error is returned when sending the event into the channel fails .
pub async fn emit(&mut self, event: Event) -> Result<(), mpsc::SendError> {
        if let Some(sender) = &mut self.sender {
            if self.allowed_events.contains(&event.ty()) {
                sender.send(event).await?;
            }
        }
        Ok(())
    }
pub async fn emit ( & mut self , event : Event ) -> Result < ( ) , mpsc :: SendError > { if let Some ( sender ) = & mut self . sender { if self . allowed_events . contains ( & event . ty ( ) ) { sender . send ( event ) . await ? ; } } Ok ( ( ) ) }
Emits an event.
Emits an event .
&mut self
event
Event