aws_sdk_sesv2/protocol_serde/
shape_blacklist_report.rs

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