pub fn add_consumer<T: 'static>(&mut self, config: ConsumerConfig<'_, T>)
    where
        T: EventConsumer + Send + Sync,
    {
        let subscriber_weak = Arc::downgrade(config.consumer);
        for event_type in config.events {
            self.consumers.entry(event_type.into()).or_default().push(subscriber_weak.clone());
        }
        for event_type in config.singleton_events {
            self.consumers.entry(event_type.into()).or_default().push(subscriber_weak.clone());
        }
    }
/// Registers an event consumer with the given configuration specifying the types of events the
/// given consumer will receive.
Registers an event consumer with the given configuration specifying the types of events the
given consumer will receive.
Registers an event consumer with the given configuration specifying the types of events the given consumer will receive .
pub fn add_consumer<T: 'static>(&mut self, config: ConsumerConfig<'_, T>)
    where
        T: EventConsumer + Send + Sync,
    {
        let subscriber_weak = Arc::downgrade(config.consumer);
        for event_type in config.events {
            self.consumers.entry(event_type.into()).or_default().push(subscriber_weak.clone());
        }
        for event_type in config.singleton_events {
            self.consumers.entry(event_type.into()).or_default().push(subscriber_weak.clone());
        }
    }
pub fn add_consumer < T : ' static > ( & mut self , config : ConsumerConfig < ' _ , T > ) where T : EventConsumer + Send + Sync , { let subscriber_weak = Arc :: downgrade ( config . consumer ) ; for event_type in config . events { self . consumers . entry ( event_type . into ( ) ) . or_default ( ) . push ( subscriber_weak . clone ( ) ) ; } for event_type in config . singleton_events { self . consumers . entry ( event_type . into ( ) ) . or_default ( ) . push ( subscriber_weak . clone ( ) ) ; } }
Registers an event consumer with the given configuration specifying the types of events the
given consumer will receive.
Registers an event consumer with the given configuration specifying the types of events the given consumer will receive .
&mut self
config
ConsumerConfig<'_, T>
&mut self
config
ConsumerConfig<'_, T>