pub(crate) fn de_contributor_attributes(
decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<::std::collections::HashMap<::std::string::String, ::std::string::String>, ::aws_smithy_cbor::decode::DeserializeError> {
fn pair(
mut map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<::std::collections::HashMap<::std::string::String, ::std::string::String>, ::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.string()?,
};
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)
}