1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | pub(crate) fn de_additional_version_weights<'a, I>(
|
3 3 | tokens: &mut ::std::iter::Peekable<I>,
|
4 4 | _value: &'a [u8],
|
5 5 | ) -> ::std::result::Result<Option<::std::collections::HashMap<::std::string::String, f64>>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
6 6 | where
|
7 7 | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
8 8 | {
|
9 9 | match tokens.next().transpose()? {
|
10 10 | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
|
11 11 | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
|
12 12 | let mut map = ::std::collections::HashMap::new();
|
13 13 | loop {
|
14 14 | match tokens.next().transpose()? {
|
15 15 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
16 16 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
17 17 | let key = key.to_unescaped().map(|u| u.into_owned())?;
|
18 18 | let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy());
|
19 - | if let Some(value) = value {
|
20 - | map.insert(key, value);
|
19 + | match value {
|
20 + | Some(value) => {
|
21 + | map.insert(key, value);
|
22 + | }
|
23 + | None => {
|
24 + | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
25 + | "dense map cannot contain null values",
|
26 + | ))
|
27 + | }
|
21 28 | }
|
22 29 | }
|
23 30 | other => {
|
24 31 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
25 32 | "expected object key or end object, found: {other:?}"
|
26 33 | )))
|
27 34 | }
|
28 35 | }
|
29 36 | }
|
30 37 | Ok(Some(map))
|