aws-sdk-cloudwatch 1.109.0

AWS SDK for Amazon CloudWatch
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_datapoint_value_map(
    decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<::std::collections::HashMap<::std::string::String, f64>, ::aws_smithy_cbor::decode::DeserializeError> {
    fn pair(
        mut map: ::std::collections::HashMap<::std::string::String, f64>,
        decoder: &mut ::aws_smithy_cbor::Decoder,
    ) -> ::std::result::Result<::std::collections::HashMap<::std::string::String, f64>, ::aws_smithy_cbor::decode::DeserializeError> {
        let key = decoder.string()?;
        let value = match decoder.datatype()? {
            ::aws_smithy_cbor::data::Type::Null => {
                return ::std::result::Result::Err(::aws_smithy_cbor::decode::DeserializeError::custom(
                    "dense map cannot contain null values",
                    decoder.position(),
                ))
            }
            _ => decoder.double()?,
        };
        map.insert(key, value);
        Ok(map)
    }

    let mut map = ::std::collections::HashMap::new();

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

    Ok(map)
}