aws_sdk_s3/protocol_serde/
shape_part.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_part(decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder) -> Result<crate::types::Part, ::aws_smithy_xml::decode::XmlDecodeError> {
4    #[allow(unused_mut)]
5    let mut builder = crate::types::Part::builder();
6    while let Some(mut tag) = decoder.next_tag() {
7        match tag.start_el() {
8            s if s.matches("PartNumber") /* PartNumber com.amazonaws.s3#Part$PartNumber */ =>  {
9                let var_1 =
10                    Some(
11                         {
12                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
13                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
14                            )
15                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.s3#PartNumber`)"))
16                        }
17                        ?
18                    )
19                ;
20                builder = builder.set_part_number(var_1);
21            }
22            ,
23            s if s.matches("LastModified") /* LastModified com.amazonaws.s3#Part$LastModified */ =>  {
24                let var_2 =
25                    Some(
26                        ::aws_smithy_types::DateTime::from_str(
27                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
29                        )
30                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.s3#LastModified`)"))
31                        ?
32                    )
33                ;
34                builder = builder.set_last_modified(var_2);
35            }
36            ,
37            s if s.matches("ETag") /* ETag com.amazonaws.s3#Part$ETag */ =>  {
38                let var_3 =
39                    Some(
40                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
41                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            .into()
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_e_tag(var_3);
48            }
49            ,
50            s if s.matches("Size") /* Size com.amazonaws.s3#Part$Size */ =>  {
51                let var_4 =
52                    Some(
53                         {
54                            <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
55                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56                            )
57                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.s3#Size`)"))
58                        }
59                        ?
60                    )
61                ;
62                builder = builder.set_size(var_4);
63            }
64            ,
65            s if s.matches("ChecksumCRC32") /* ChecksumCRC32 com.amazonaws.s3#Part$ChecksumCRC32 */ =>  {
66                let var_5 =
67                    Some(
68                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
69                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
70                            .into()
71                        )
72                        ?
73                    )
74                ;
75                builder = builder.set_checksum_crc32(var_5);
76            }
77            ,
78            s if s.matches("ChecksumCRC32C") /* ChecksumCRC32C com.amazonaws.s3#Part$ChecksumCRC32C */ =>  {
79                let var_6 =
80                    Some(
81                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
82                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83                            .into()
84                        )
85                        ?
86                    )
87                ;
88                builder = builder.set_checksum_crc32_c(var_6);
89            }
90            ,
91            s if s.matches("ChecksumSHA1") /* ChecksumSHA1 com.amazonaws.s3#Part$ChecksumSHA1 */ =>  {
92                let var_7 =
93                    Some(
94                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
95                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96                            .into()
97                        )
98                        ?
99                    )
100                ;
101                builder = builder.set_checksum_sha1(var_7);
102            }
103            ,
104            s if s.matches("ChecksumSHA256") /* ChecksumSHA256 com.amazonaws.s3#Part$ChecksumSHA256 */ =>  {
105                let var_8 =
106                    Some(
107                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
108                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
109                            .into()
110                        )
111                        ?
112                    )
113                ;
114                builder = builder.set_checksum_sha256(var_8);
115            }
116            ,
117            _ => {}
118        }
119    }
120    Ok(builder.build())
121}