aws_sdk_ec2/protocol_serde/
shape_capacity_allocation.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_capacity_allocation(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::CapacityAllocation, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::CapacityAllocation::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("allocationType") => {
11 let var_1 =
12 Some(
13 Result::<crate::types::AllocationType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14 crate::types::AllocationType::from(
15 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16 )
17 )
18 ?
19 )
20 ;
21 builder = builder.set_allocation_type(var_1);
22 }
23 ,
24 s if s.matches("count") => {
25 let var_2 =
26 Some(
27 {
28 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
29 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
30 )
31 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
32 }
33 ?
34 )
35 ;
36 builder = builder.set_count(var_2);
37 }
38 ,
39 _ => {}
40 }
41 }
42 Ok(builder.build())
43}