1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | pub(crate) fn de_log_record<'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, ::std::string::String>>,
|
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 = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
22 22 | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
23 23 | .transpose()?;
|
24 - | if let Some(value) = value {
|
25 - | map.insert(key, value);
|
24 + | match value {
|
25 + | Some(value) => {
|
26 + | map.insert(key, value);
|
27 + | }
|
28 + | None => {
|
29 + | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
30 + | "dense map cannot contain null values",
|
31 + | ))
|
32 + | }
|
26 33 | }
|
27 34 | }
|
28 35 | other => {
|
29 36 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
30 37 | "expected object key or end object, found: {other:?}"
|
31 38 | )))
|
32 39 | }
|
33 40 | }
|
34 41 | }
|
35 42 | Ok(Some(map))
|