aws_sdk_ec2/protocol_serde/
shape_instance_ipv6_address.rs

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