aws_sdk_ec2/protocol_serde/
shape_private_ip_address_specification.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_private_ip_address_specification(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::PrivateIpAddressSpecification,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("Primary");
9    if let Some(var_2) = &input.primary {
10        scope_1.boolean(*var_2);
11    }
12    #[allow(unused_mut)]
13    let mut scope_3 = writer.prefix("PrivateIpAddress");
14    if let Some(var_4) = &input.private_ip_address {
15        scope_3.string(var_4);
16    }
17    Ok(())
18}
19
20#[allow(clippy::needless_question_mark)]
21pub fn de_private_ip_address_specification(
22    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
23) -> ::std::result::Result<crate::types::PrivateIpAddressSpecification, ::aws_smithy_xml::decode::XmlDecodeError> {
24    #[allow(unused_mut)]
25    let mut builder = crate::types::PrivateIpAddressSpecification::builder();
26    while let Some(mut tag) = decoder.next_tag() {
27        match tag.start_el() {
28            s if s.matches("primary") /* Primary com.amazonaws.ec2#PrivateIpAddressSpecification$Primary */ =>  {
29                let var_5 =
30                    Some(
31                         {
32                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
33                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
34                            )
35                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
36                        }
37                        ?
38                    )
39                ;
40                builder = builder.set_primary(var_5);
41            }
42            ,
43            s if s.matches("privateIpAddress") /* PrivateIpAddress com.amazonaws.ec2#PrivateIpAddressSpecification$PrivateIpAddress */ =>  {
44                let var_6 =
45                    Some(
46                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
47                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
48                            .into()
49                        )
50                        ?
51                    )
52                ;
53                builder = builder.set_private_ip_address(var_6);
54            }
55            ,
56            _ => {}
57        }
58    }
59    Ok(builder.build())
60}