pub fn serialize<W: Write>(self, writer: &mut W) -> Result<(), ProgramError> {
        if self.account_type == GovernanceAccountType::SignatoryRecordV2 {
            BorshSerialize::serialize(&self, writer)?
        } else if self.account_type == GovernanceAccountType::SignatoryRecordV1 {
            // V1 account can't be resized and we have to translate it back to the original format

            // If reserved_v2 is used it must be individually asses for v1 backward compatibility impact
            if self.reserved_v2 != [0; 8] {
                panic!("Extended data not supported by SignatoryRecordV1")
            }

            let signatory_record_data_v1 = SignatoryRecordV1 {
                account_type: self.account_type,
                proposal: self.proposal,
                signatory: self.signatory,
                signed_off: self.signed_off,
            };

            BorshSerialize::serialize(&signatory_record_data_v1, writer)?;
        }

        Ok(())
    }
/// Serializes account into the target buffer
Serializes account into the target buffer
Serializes account into the target buffer
pub fn serialize<W: Write>(self, writer: &mut W) -> Result<(), ProgramError> {
        if self.account_type == GovernanceAccountType::SignatoryRecordV2 {
            BorshSerialize::serialize(&self, writer)?
        } else if self.account_type == GovernanceAccountType::SignatoryRecordV1 {
            // V1 account can't be resized and we have to translate it back to the original format
            // If reserved_v2 is used it must be individually asses for v1 backward compatibility impact
            if self.reserved_v2 != [0; 8] {
                panic!("Extended data not supported by SignatoryRecordV1")
            }
            let signatory_record_data_v1 = SignatoryRecordV1 {
                account_type: self.account_type,
                proposal: self.proposal,
                signatory: self.signatory,
                signed_off: self.signed_off,
            };
            BorshSerialize::serialize(&signatory_record_data_v1, writer)?;
        }
        Ok(())
    }
pub fn serialize < W : Write > ( self , writer : & mut W ) -> Result < ( ) , ProgramError > { if self . account_type == GovernanceAccountType :: SignatoryRecordV2 { BorshSerialize :: serialize ( & self , writer ) ? } else if self . account_type == GovernanceAccountType :: SignatoryRecordV1 { // V1 account can't be resized and we have to translate it back to the original format // If reserved_v2 is used it must be individually asses for v1 backward compatibility impact if self . reserved_v2 != [ 0 ; 8 ] { panic ! ( " " ) } let signatory_record_data_v1 = SignatoryRecordV1 { account_type : self . account_type , proposal : self . proposal , signatory : self . signatory , signed_off : self . signed_off , } ; BorshSerialize :: serialize ( & signatory_record_data_v1 , writer ) ? ; } Ok ( ( ) ) }
Serializes account into the target buffer
Serializes account into the target buffer
self
writer
&mut W
self
writer
&mut W