aws_sdk_appconfig/protocol_serde/
shape_actions_map.rs1pub(crate) fn de_actions_map<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4 _value: &'a [u8],
5) -> ::std::result::Result<
6 Option<::std::collections::HashMap<crate::types::ActionPoint, ::std::vec::Vec<crate::types::Action>>>,
7 ::aws_smithy_json::deserialize::error::DeserializeError,
8>
9where
10 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
11{
12 match tokens.next().transpose()? {
13 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
14 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
15 let mut map = ::std::collections::HashMap::new();
16 loop {
17 match tokens.next().transpose()? {
18 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
19 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
20 let key = key.to_unescaped().map(|u| crate::types::ActionPoint::from(u.as_ref()))?;
21 let value = crate::protocol_serde::shape_action_list::de_action_list(tokens, _value)?;
22 match value {
23 Some(value) => {
24 map.insert(key, value);
25 }
26 None => {
27 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
28 "dense map cannot contain null values",
29 ))
30 }
31 }
32 }
33 other => {
34 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
35 "expected object key or end object, found: {other:?}"
36 )))
37 }
38 }
39 }
40 Ok(Some(map))
41 }
42 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
43 "expected start object or null",
44 )),
45 }
46}