pub fn init_account_extension_from_type(
        &mut self,
        extension_type: ExtensionType,
    ) -> Result<(), ProgramError> {
        if extension_type.get_account_type() != AccountType::Account {
            return Ok(());
        }
        match extension_type {
            ExtensionType::TransferFeeAmount => {
                self.init_extension::<TransferFeeAmount>().map(|_| ())
            }
            // ConfidentialTransfers are currently opt-in only, so this is a no-op for extra safety
            // on InitializeAccount
            ExtensionType::ConfidentialTransferAccount => Ok(()),
            #[cfg(test)]
            ExtensionType::AccountPaddingTest => {
                self.init_extension::<AccountPaddingTest>().map(|_| ())
            }
            _ => unreachable!(),
        }
    }
/// If `extension_type` is an Account-associated ExtensionType that requires initialization on
/// InitializeAccount, this method packs the default relevant Extension of an ExtensionType
/// into an open slot if not already found in the data buffer, otherwise overwrites the
/// existing extension with the default state. For all other ExtensionTypes, this is a no-op.
If `extension_type` is an Account-associated ExtensionType that requires initialization on
InitializeAccount, this method packs the default relevant Extension of an ExtensionType
into an open slot if not already found in the data buffer, otherwise overwrites the
existing extension with the default state. For all other ExtensionTypes, this is a no-op.
If ` extension_type ` is an Account - associated ExtensionType that requires initialization on InitializeAccount this method packs the default relevant Extension of an ExtensionType into an open slot if not already found in the data buffer otherwise overwrites the existing extension with the default state . For all other ExtensionTypes this is a no - op .
pub fn init_account_extension_from_type(
        &mut self,
        extension_type: ExtensionType,
    ) -> Result<(), ProgramError> {
        if extension_type.get_account_type() != AccountType::Account {
            return Ok(());
        }
        match extension_type {
            ExtensionType::TransferFeeAmount => {
                self.init_extension::<TransferFeeAmount>().map(|_| ())
            }
            // ConfidentialTransfers are currently opt-in only, so this is a no-op for extra safety
            // on InitializeAccount
            ExtensionType::ConfidentialTransferAccount => Ok(()),
            #[cfg(test)]
            ExtensionType::AccountPaddingTest => {
                self.init_extension::<AccountPaddingTest>().map(|_| ())
            }
            _ => unreachable!(),
        }
    }
pub fn init_account_extension_from_type ( & mut self , extension_type : ExtensionType , ) -> Result < ( ) , ProgramError > { if extension_type . get_account_type ( ) != AccountType :: Account { return Ok ( ( ) ) ; } match extension_type { ExtensionType :: TransferFeeAmount => { self . init_extension :: < TransferFeeAmount > ( ) . map ( | _ | ( ) ) } // ConfidentialTransfers are currently opt-in only, so this is a no-op for extra safety // on InitializeAccount ExtensionType :: ConfidentialTransferAccount => Ok ( ( ) ) , # [ cfg ( test ) ] ExtensionType :: AccountPaddingTest => { self . init_extension :: < AccountPaddingTest > ( ) . map ( | _ | ( ) ) } _ => unreachable ! ( ) , } }
If `extension_type` is an Account-associated ExtensionType that requires initialization on
InitializeAccount, this method packs the default relevant Extension of an ExtensionType
into an open slot if not already found in the data buffer, otherwise overwrites the
existing extension with the default state.
If ` extension_type ` is an Account - associated ExtensionType that requires initialization on InitializeAccount this method packs the default relevant Extension of an ExtensionType into an open slot if not already found in the data buffer otherwise overwrites the existing extension with the default state .
&mut self
extension_type
ExtensionType
&mut self
extension_type
ExtensionType