aws_sdk_s3/protocol_serde/
shape_server_side_encryption_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_server_side_encryption_configuration(
3    input: &crate::types::ServerSideEncryptionConfiguration,
4    writer: ::aws_smithy_xml::encode::ElWriter,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    #[allow(unused_mut)]
7    let mut scope = writer.finish();
8    {
9        for list_item_1 in &input.rules {
10            {
11                let inner_writer = scope.start_el("Rule");
12                crate::protocol_serde::shape_server_side_encryption_rule::ser_server_side_encryption_rule(list_item_1, inner_writer)?
13            }
14        }
15    }
16    scope.finish();
17    Ok(())
18}
19
20#[allow(clippy::needless_question_mark)]
21pub fn de_server_side_encryption_configuration(
22    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
23) -> ::std::result::Result<crate::types::ServerSideEncryptionConfiguration, ::aws_smithy_xml::decode::XmlDecodeError> {
24    #[allow(unused_mut)]
25    let mut builder = crate::types::ServerSideEncryptionConfiguration::builder();
26    while let Some(mut tag) = decoder.next_tag() {
27        match tag.start_el() {
28            s if s.matches("Rule") /* Rules com.amazonaws.s3#ServerSideEncryptionConfiguration$Rules */ =>  {
29                let var_2 =
30                    Some(
31                        Result::<::std::vec::Vec::<crate::types::ServerSideEncryptionRule>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
32                            let mut list_3 = builder.rules.take().unwrap_or_default();
33                            list_3.push(
34                                crate::protocol_serde::shape_server_side_encryption_rule::de_server_side_encryption_rule(&mut tag)
35                                ?
36                            );
37                            list_3
38                        })
39                        ?
40                    )
41                ;
42                builder = builder.set_rules(var_2);
43            }
44            ,
45            _ => {}
46        }
47    }
48    Ok(crate::serde_util::server_side_encryption_configuration_correct_errors(builder)
49        .build()
50        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
51}