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