fn try_from(init: MSasV1ContentInit) -> Result<Self, Self::Error> {
        if !init.key_agreement_protocols.contains(&KeyAgreementProtocol::Curve25519)
            && !init.key_agreement_protocols.contains(&KeyAgreementProtocol::Curve25519HkdfSha256)
        {
            return Err(InvalidInput(
                "`key_agreement_protocols` must contain at \
                 least `KeyAgreementProtocol::Curve25519` or \
                 `KeyAgreementProtocol::Curve25519HkdfSha256`"
                    .into(),
            ));
        }

        if !init.hashes.contains(&HashAlgorithm::Sha256) {
            return Err(InvalidInput(
                "`hashes` must contain at least `HashAlgorithm::Sha256`".into(),
            ));
        }

        if !init.message_authentication_codes.contains(&MessageAuthenticationCode::HkdfHmacSha256) {
            return Err(InvalidInput(
                "`message_authentication_codes` must contain \
                 at least `MessageAuthenticationCode::HkdfHmacSha256`"
                    .into(),
            ));
        }

        if !init.short_authentication_string.contains(&ShortAuthenticationString::Decimal) {
            return Err(InvalidInput(
                "`short_authentication_string` must contain \
                 at least `ShortAuthenticationString::Decimal`"
                    .into(),
            ));
        }

        Ok(Self {
            key_agreement_protocols: init.key_agreement_protocols,
            hashes: init.hashes,
            message_authentication_codes: init.message_authentication_codes,
            short_authentication_string: init.short_authentication_string,
        })
    }
/// Creates a new `MSasV1Content` from the given init struct.
Creates a new `MSasV1Content` from the given init struct.
Creates a new ` MSasV1Content ` from the given init struct .
fn try_from(init: MSasV1ContentInit) -> Result<Self, Self::Error> {
        if !init.key_agreement_protocols.contains(&KeyAgreementProtocol::Curve25519)
            && !init.key_agreement_protocols.contains(&KeyAgreementProtocol::Curve25519HkdfSha256)
        {
            return Err(InvalidInput(
                "`key_agreement_protocols` must contain at \
                 least `KeyAgreementProtocol::Curve25519` or \
                 `KeyAgreementProtocol::Curve25519HkdfSha256`"
                    .into(),
            ));
        }
        if !init.hashes.contains(&HashAlgorithm::Sha256) {
            return Err(InvalidInput(
                "`hashes` must contain at least `HashAlgorithm::Sha256`".into(),
            ));
        }
        if !init.message_authentication_codes.contains(&MessageAuthenticationCode::HkdfHmacSha256) {
            return Err(InvalidInput(
                "`message_authentication_codes` must contain \
                 at least `MessageAuthenticationCode::HkdfHmacSha256`"
                    .into(),
            ));
        }
        if !init.short_authentication_string.contains(&ShortAuthenticationString::Decimal) {
            return Err(InvalidInput(
                "`short_authentication_string` must contain \
                 at least `ShortAuthenticationString::Decimal`"
                    .into(),
            ));
        }
        Ok(Self {
            key_agreement_protocols: init.key_agreement_protocols,
            hashes: init.hashes,
            message_authentication_codes: init.message_authentication_codes,
            short_authentication_string: init.short_authentication_string,
        })
    }
fn try_from ( init : MSasV1ContentInit ) -> Result < Self , Self :: Error > { if ! init . key_agreement_protocols . contains ( & KeyAgreementProtocol :: Curve25519 ) && ! init . key_agreement_protocols . contains ( & KeyAgreementProtocol :: Curve25519HkdfSha256 ) { return Err ( InvalidInput ( " \
 \
 " . into ( ) , ) ) ; } if ! init . hashes . contains ( & HashAlgorithm :: Sha256 ) { return Err ( InvalidInput ( " " . into ( ) , ) ) ; } if ! init . message_authentication_codes . contains ( & MessageAuthenticationCode :: HkdfHmacSha256 ) { return Err ( InvalidInput ( " \
 " . into ( ) , ) ) ; } if ! init . short_authentication_string . contains ( & ShortAuthenticationString :: Decimal ) { return Err ( InvalidInput ( " \
 " . into ( ) , ) ) ; } Ok ( Self { key_agreement_protocols : init . key_agreement_protocols , hashes : init . hashes , message_authentication_codes : init . message_authentication_codes , short_authentication_string : init . short_authentication_string , } ) }
Creates a new `MSasV1Content` from the given init struct.
Creates a new ` MSasV1Content ` from the given init struct .
init
MSasV1ContentInit
init
MSasV1ContentInit