aws_sdk_ec2/protocol_serde/
shape_network_bandwidth_gbps.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_network_bandwidth_gbps(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::NetworkBandwidthGbps,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("Min");
9    if let Some(var_2) = &input.min {
10        scope_1.number(
11            #[allow(clippy::useless_conversion)]
12            ::aws_smithy_types::Number::Float((*var_2).into()),
13        );
14    }
15    #[allow(unused_mut)]
16    let mut scope_3 = writer.prefix("Max");
17    if let Some(var_4) = &input.max {
18        scope_3.number(
19            #[allow(clippy::useless_conversion)]
20            ::aws_smithy_types::Number::Float((*var_4).into()),
21        );
22    }
23    Ok(())
24}
25
26#[allow(clippy::needless_question_mark)]
27pub fn de_network_bandwidth_gbps(
28    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
29) -> ::std::result::Result<crate::types::NetworkBandwidthGbps, ::aws_smithy_xml::decode::XmlDecodeError> {
30    #[allow(unused_mut)]
31    let mut builder = crate::types::NetworkBandwidthGbps::builder();
32    while let Some(mut tag) = decoder.next_tag() {
33        match tag.start_el() {
34            s if s.matches("min") /* Min com.amazonaws.ec2#NetworkBandwidthGbps$Min */ =>  {
35                let var_5 =
36                    Some(
37                         {
38                            <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
39                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
40                            )
41                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (double: `com.amazonaws.ec2#Double`)"))
42                        }
43                        ?
44                    )
45                ;
46                builder = builder.set_min(var_5);
47            }
48            ,
49            s if s.matches("max") /* Max com.amazonaws.ec2#NetworkBandwidthGbps$Max */ =>  {
50                let var_6 =
51                    Some(
52                         {
53                            <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
54                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55                            )
56                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (double: `com.amazonaws.ec2#Double`)"))
57                        }
58                        ?
59                    )
60                ;
61                builder = builder.set_max(var_6);
62            }
63            ,
64            _ => {}
65        }
66    }
67    Ok(builder.build())
68}