aws-sdk-interconnect 1.1.0

AWS SDK for Interconnect
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_throttling_exception_cbor_err(
    value: &[u8],
    mut builder: crate::types::error::builders::ThrottlingExceptionBuilder,
) -> ::std::result::Result<crate::types::error::builders::ThrottlingExceptionBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
    #[allow(clippy::match_single_binding)]
    fn pair(
        mut builder: crate::types::error::builders::ThrottlingExceptionBuilder,
        decoder: &mut ::aws_smithy_cbor::Decoder,
    ) -> ::std::result::Result<crate::types::error::builders::ThrottlingExceptionBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
        builder = match decoder.str()?.as_ref() {
            "message" => {
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_message(Some(decoder.string()?))))?
            }
            _ => {
                decoder.skip()?;
                builder
            }
        };
        Ok(builder)
    }

    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);

    match decoder.map()? {
        None => loop {
            match decoder.datatype()? {
                ::aws_smithy_cbor::data::Type::Break => {
                    decoder.skip()?;
                    break;
                }
                _ => {
                    builder = pair(builder, decoder)?;
                }
            };
        },
        Some(n) => {
            for _ in 0..n {
                builder = pair(builder, decoder)?;
            }
        }
    };

    if decoder.position() != value.len() {
        return Err(::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()));
    }

    Ok(builder)
}