pub fn subscribe(
        &mut self,
        topic_name: &str,
        poll_configuration: PollConfiguration,
    ) -> Result<SubscriberId, EventError> {
        if !self.topics.contains_key(topic_name) {
            Err(EventError::TopicDoesNotExist)
        } else {
            let next_id = self.subscribers.keys().max().map_or(0, |r| r + 1);
            self.subscribers.insert(
                next_id,
                (
                    topic_name.to_string(),
                    poll_configuration,
                    self.topics
                        .get(topic_name)
                        .expect("A topic is missing, but is identified as existing")
                        .messages
                        .len(),
                ),
            );
            Ok(next_id)
        }
    }
/// Creates a subscription to the topic `topic_name` using `poll_configuration`
Creates a subscription to the topic `topic_name` using `poll_configuration`
Creates a subscription to the topic ` topic_name ` using ` poll_configuration `
pub fn subscribe(
        &mut self,
        topic_name: &str,
        poll_configuration: PollConfiguration,
    ) -> Result<SubscriberId, EventError> {
        if !self.topics.contains_key(topic_name) {
            Err(EventError::TopicDoesNotExist)
        } else {
            let next_id = self.subscribers.keys().max().map_or(0, |r| r + 1);
            self.subscribers.insert(
                next_id,
                (
                    topic_name.to_string(),
                    poll_configuration,
                    self.topics
                        .get(topic_name)
                        .expect("A topic is missing, but is identified as existing")
                        .messages
                        .len(),
                ),
            );
            Ok(next_id)
        }
    }
pub fn subscribe ( & mut self , topic_name : & str , poll_configuration : PollConfiguration , ) -> Result < SubscriberId , EventError > { if ! self . topics . contains_key ( topic_name ) { Err ( EventError :: TopicDoesNotExist ) } else { let next_id = self . subscribers . keys ( ) . max ( ) . map_or ( 0 , | r | r + 1 ) ; self . subscribers . insert ( next_id , ( topic_name . to_string ( ) , poll_configuration , self . topics . get ( topic_name ) . expect ( " " ) . messages . len ( ) , ) , ) ; Ok ( next_id ) } }
Creates a subscription to the topic `topic_name` using `poll_configuration`
Creates a subscription to the topic ` topic_name ` using ` poll_configuration `
&mut self
topic_name
&str
poll_configuration
PollConfiguration
&mut self
topic_name
&str
poll_configuration
PollConfiguration