Skip to main content

aws_sdk_glue/schema_serde/
shape_get_mapping_output_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static GETMAPPINGOUTPUT_MEMBER_MAPPING_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#MappingList$member", "com.amazonaws.glue", "MappingList"),
4    ::aws_smithy_schema::ShapeType::Structure,
5    "member",
6    0,
7);
8static GETMAPPINGOUTPUT_MEMBER_MAPPING: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
9    ::aws_smithy_schema::ShapeId::from_parts(
10        "com.amazonaws.glue.synthetic#GetMappingOutput$Mapping",
11        "com.amazonaws.glue.synthetic",
12        "GetMappingOutput",
13    ),
14    ::aws_smithy_schema::ShapeType::List,
15    "Mapping",
16    0,
17)
18.with_list_member(&GETMAPPINGOUTPUT_MEMBER_MAPPING_MEMBER);
19static GETMAPPINGOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
20    ::aws_smithy_schema::ShapeId::from_parts(
21        "com.amazonaws.glue.synthetic#GetMappingOutput",
22        "com.amazonaws.glue.synthetic",
23        "GetMappingOutput",
24    ),
25    ::aws_smithy_schema::ShapeType::Structure,
26    &[&GETMAPPINGOUTPUT_MEMBER_MAPPING],
27)
28.with_original_name("GetMappingResponse");
29impl crate::operation::get_mapping::GetMappingOutput {
30    /// The schema for this shape.
31    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &GETMAPPINGOUTPUT_SCHEMA;
32}
33impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::get_mapping::GetMappingOutput {
34    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
35        Self::SCHEMA
36    }
37
38    #[allow(unused_variables, clippy::diverging_sub_expression)]
39    fn serialize_members(
40        &self,
41        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
42    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
43        {
44            let val = &self.mapping;
45
46            ser.write_list(
47                &GETMAPPINGOUTPUT_MEMBER_MAPPING,
48                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
49                    for item in val {
50                        ser.write_struct(crate::types::MappingEntry::SCHEMA, item)?;
51                    }
52                    Ok(())
53                },
54            )?;
55        }
56        Ok(())
57    }
58}
59impl crate::operation::get_mapping::builders::GetMappingOutputBuilder {
60    #[allow(
61        unused_variables,
62        unreachable_code,
63        clippy::single_match,
64        clippy::match_single_binding,
65        clippy::diverging_sub_expression
66    )]
67    pub(crate) fn deserialize_members(
68        &mut self,
69        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
70    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
71        deserializer.read_struct(&GETMAPPINGOUTPUT_SCHEMA, &mut |member, deser| {
72            match member.member_index() {
73                Some(0) => {
74                    self.mapping = Some({
75                        let mut container = Vec::new();
76                        deser.read_list(member, &mut |deser| {
77                            container.push(crate::types::MappingEntry::deserialize(deser)?);
78                            Ok(())
79                        })?;
80                        container
81                    });
82                }
83                _ => {}
84            }
85            Ok(())
86        })
87    }
88}
89
90impl crate::operation::get_mapping::GetMappingOutput {
91    /// Deserializes this structure from a [`ShapeDeserializer`].
92    pub fn deserialize(
93        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
94    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
95        let mut builder = Self::builder();
96        builder.deserialize_members(deserializer)?;
97        builder.mapping = builder.mapping.or(Some(Vec::new()));
98        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
99    }
100}