aws-sdk-mailmanager 1.89.0

AWS SDK for MailManager
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_trust_store(
    decoder: &mut ::aws_smithy_cbor::Decoder,
    depth: u32,
) -> ::std::result::Result<crate::types::TrustStore, ::aws_smithy_cbor::decode::DeserializeError> {
    if depth >= 128u32 {
        return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
            "maximum nesting depth exceeded",
            decoder.position(),
        ));
    }
    #[allow(clippy::match_single_binding, unused_variables)]
    fn pair(
        mut builder: crate::types::builders::TrustStoreBuilder,
        decoder: &mut ::aws_smithy_cbor::Decoder,
        depth: u32,
    ) -> ::std::result::Result<crate::types::builders::TrustStoreBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
        builder = match decoder.str()?.as_ref() {
            "CAContent" => builder.set_ca_content(Some(decoder.string()?)),
            "CrlContent" => {
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_crl_content(Some(decoder.string()?))))?
            }
            "KmsKeyArn" => {
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_kms_key_arn(Some(decoder.string()?))))?
            }
            _ => {
                decoder.skip()?;
                builder
            }
        };
        Ok(builder)
    }

    let mut builder = crate::types::builders::TrustStoreBuilder::default();

    match decoder.map()? {
        None => loop {
            match decoder.datatype()? {
                ::aws_smithy_cbor::data::Type::Break => {
                    decoder.skip()?;
                    break;
                }
                _ => {
                    builder = pair(builder, decoder, depth)?;
                }
            };
        },
        Some(n) => {
            for _ in 0..n {
                builder = pair(builder, decoder, depth)?;
            }
        }
    };
    #[allow(clippy::needless_question_mark)]
    {
        return Ok(crate::serde_util::trust_store_correct_errors(builder)
            .build()
            .map_err(|err| ::aws_smithy_cbor::decode::DeserializeError::custom(err.to_string(), decoder.position()))?);
    }
}

pub fn ser_trust_store(
    encoder: &mut ::aws_smithy_cbor::Encoder,
    #[allow(unused)] input: &crate::types::TrustStore,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    encoder.begin_map();
    {
        encoder.str("CAContent").str(input.ca_content.as_str());
    }
    if let Some(var_1) = &input.crl_content {
        encoder.str("CrlContent").str(var_1.as_str());
    }
    if let Some(var_2) = &input.kms_key_arn {
        encoder.str("KmsKeyArn").str(var_2.as_str());
    }
    encoder.end();
    Ok(())
}