Skip to main content

aws_sdk_glue/schema_serde/
shape_partition_index.rs

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