aws_sdk_redshift/protocol_serde/
shape_encryption_context_map.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn de_encryption_context_map(
3    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
4) -> ::std::result::Result<::std::collections::HashMap<::std::string::String, ::std::string::String>, ::aws_smithy_xml::decode::XmlDecodeError> {
5    let mut out = ::std::collections::HashMap::new();
6    while let Some(mut tag) = decoder.next_tag() {
7        match tag.start_el() {
8            s if s.matches("entry") => {
9                crate::protocol_serde::shape_encryption_context_map::de_encryption_context_map_entry(&mut tag, &mut out)?;
10            }
11            _ => {}
12        }
13    }
14    Ok(out)
15}
16
17pub fn de_encryption_context_map_entry(
18    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
19    out: &mut ::std::collections::HashMap<::std::string::String, ::std::string::String>,
20) -> ::std::result::Result<(), ::aws_smithy_xml::decode::XmlDecodeError> {
21    let mut k: Option<::std::string::String> = None;
22    let mut v: Option<::std::string::String> = None;
23    while let Some(mut tag) = decoder.next_tag() {
24        match tag.start_el() {
25            s if s.matches("key") /* key com.amazonaws.redshift#EncryptionContextMap$key */ =>  {
26                k = Some(
27                    Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
28                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                        .into()
30                    )
31                    ?
32                )
33            }
34            ,
35            s if s.matches("value") /* value com.amazonaws.redshift#EncryptionContextMap$value */ =>  {
36                v = Some(
37                    Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
38                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
39                        .into()
40                    )
41                    ?
42                )
43            }
44            ,
45            _ => {}
46        }
47    }
48    let k = k.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing key map entry"))?;
49    let v = v.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing value map entry"))?;
50    out.insert(k, v);
51    Ok(())
52}