aws_sdk_ec2/protocol_serde/
shape_block_device_mapping.rs1#[allow(unused_mut)]
3pub fn ser_block_device_mapping(
4 mut writer: ::aws_smithy_query::QueryValueWriter,
5 input: &crate::types::BlockDeviceMapping,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7 #[allow(unused_mut)]
8 let mut scope_1 = writer.prefix("Ebs");
9 if let Some(var_2) = &input.ebs {
10 crate::protocol_serde::shape_ebs_block_device::ser_ebs_block_device(scope_1, var_2)?;
11 }
12 #[allow(unused_mut)]
13 let mut scope_3 = writer.prefix("NoDevice");
14 if let Some(var_4) = &input.no_device {
15 scope_3.string(var_4);
16 }
17 #[allow(unused_mut)]
18 let mut scope_5 = writer.prefix("DeviceName");
19 if let Some(var_6) = &input.device_name {
20 scope_5.string(var_6);
21 }
22 #[allow(unused_mut)]
23 let mut scope_7 = writer.prefix("VirtualName");
24 if let Some(var_8) = &input.virtual_name {
25 scope_7.string(var_8);
26 }
27 Ok(())
28}
29
30#[allow(clippy::needless_question_mark)]
31pub fn de_block_device_mapping(
32 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
33) -> ::std::result::Result<crate::types::BlockDeviceMapping, ::aws_smithy_xml::decode::XmlDecodeError> {
34 #[allow(unused_mut)]
35 let mut builder = crate::types::BlockDeviceMapping::builder();
36 while let Some(mut tag) = decoder.next_tag() {
37 match tag.start_el() {
38 s if s.matches("ebs") => {
39 let var_9 =
40 Some(
41 crate::protocol_serde::shape_ebs_block_device::de_ebs_block_device(&mut tag)
42 ?
43 )
44 ;
45 builder = builder.set_ebs(var_9);
46 }
47 ,
48 s if s.matches("noDevice") => {
49 let var_10 =
50 Some(
51 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
52 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
53 .into()
54 )
55 ?
56 )
57 ;
58 builder = builder.set_no_device(var_10);
59 }
60 ,
61 s if s.matches("deviceName") => {
62 let var_11 =
63 Some(
64 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
65 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
66 .into()
67 )
68 ?
69 )
70 ;
71 builder = builder.set_device_name(var_11);
72 }
73 ,
74 s if s.matches("virtualName") => {
75 let var_12 =
76 Some(
77 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
78 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
79 .into()
80 )
81 ?
82 )
83 ;
84 builder = builder.set_virtual_name(var_12);
85 }
86 ,
87 _ => {}
88 }
89 }
90 Ok(builder.build())
91}