fn insert(&mut self, content: MessageContent) -> Option<FaultKind> {
        match content {
            MessageContent::SbvBroadcast(sbv) => match sbv {
                sbv_broadcast::Message::BVal(b) => {
                    if !self.bval.insert(b) {
                        return Some(FaultKind::DuplicateBVal);
                    }
                }
                sbv_broadcast::Message::Aux(b) => {
                    if !self.aux.insert(b) {
                        return Some(FaultKind::DuplicateAux);
                    }
                }
            },
            MessageContent::Conf(bs) => {
                if self.conf.is_none() {
                    self.conf = Some(bs);
                } else {
                    return Some(FaultKind::MultipleConf);
                }
            }
            MessageContent::Term(b) => {
                if self.term.is_none() {
                    self.term = Some(b);
                } else {
                    return Some(FaultKind::MultipleTerm);
                }
            }
            MessageContent::Coin(msg) => {
                if self.coin.is_none() {
                    self.coin = Some(msg.0);
                } else {
                    return Some(FaultKind::AgreementEpoch);
                }
            }
        }
        None
    }
/// Inserts new message content if it is accepted or returns a `FaultKind` indicating an issue
/// that prevented insertion of that new content.
Inserts new message content if it is accepted or returns a `FaultKind` indicating an issue
that prevented insertion of that new content.
Inserts new message content if it is accepted or returns a ` FaultKind ` indicating an issue that prevented insertion of that new content .
fn insert(&mut self, content: MessageContent) -> Option<FaultKind> {
        match content {
            MessageContent::SbvBroadcast(sbv) => match sbv {
                sbv_broadcast::Message::BVal(b) => {
                    if !self.bval.insert(b) {
                        return Some(FaultKind::DuplicateBVal);
                    }
                }
                sbv_broadcast::Message::Aux(b) => {
                    if !self.aux.insert(b) {
                        return Some(FaultKind::DuplicateAux);
                    }
                }
            },
            MessageContent::Conf(bs) => {
                if self.conf.is_none() {
                    self.conf = Some(bs);
                } else {
                    return Some(FaultKind::MultipleConf);
                }
            }
            MessageContent::Term(b) => {
                if self.term.is_none() {
                    self.term = Some(b);
                } else {
                    return Some(FaultKind::MultipleTerm);
                }
            }
            MessageContent::Coin(msg) => {
                if self.coin.is_none() {
                    self.coin = Some(msg.0);
                } else {
                    return Some(FaultKind::AgreementEpoch);
                }
            }
        }
        None
    }
fn insert ( & mut self , content : MessageContent ) -> Option < FaultKind > { match content { MessageContent :: SbvBroadcast ( sbv ) => match sbv { sbv_broadcast :: Message :: BVal ( b ) => { if ! self . bval . insert ( b ) { return Some ( FaultKind :: DuplicateBVal ) ; } } sbv_broadcast :: Message :: Aux ( b ) => { if ! self . aux . insert ( b ) { return Some ( FaultKind :: DuplicateAux ) ; } } } , MessageContent :: Conf ( bs ) => { if self . conf . is_none ( ) { self . conf = Some ( bs ) ; } else { return Some ( FaultKind :: MultipleConf ) ; } } MessageContent :: Term ( b ) => { if self . term . is_none ( ) { self . term = Some ( b ) ; } else { return Some ( FaultKind :: MultipleTerm ) ; } } MessageContent :: Coin ( msg ) => { if self . coin . is_none ( ) { self . coin = Some ( msg . 0 ) ; } else { return Some ( FaultKind :: AgreementEpoch ) ; } } } None }
Inserts new message content if it is accepted or returns a `FaultKind` indicating an issue
that prevented insertion of that new content.
Inserts new message content if it is accepted or returns a ` FaultKind ` indicating an issue that prevented insertion of that new content .
&mut self
content
MessageContent
&mut self
content
MessageContent