aws_sdk_appconfigcloudextension/schema_serde/
shape_semantic_error.rs1static SEMANTICERROR_MEMBER_PROBLEM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3 ::aws_smithy_schema::ShapeId::from_parts(
4 "com.amazonaws.appconfigcloudextension#SemanticError$problem",
5 "com.amazonaws.appconfigcloudextension",
6 "SemanticError",
7 ),
8 ::aws_smithy_schema::ShapeType::String,
9 "problem",
10 0,
11);
12static SEMANTICERROR_MEMBER_ITEM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13 ::aws_smithy_schema::ShapeId::from_parts(
14 "com.amazonaws.appconfigcloudextension#SemanticError$item",
15 "com.amazonaws.appconfigcloudextension",
16 "SemanticError",
17 ),
18 ::aws_smithy_schema::ShapeType::String,
19 "item",
20 1,
21);
22static SEMANTICERROR_MEMBER_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23 ::aws_smithy_schema::ShapeId::from_parts(
24 "com.amazonaws.appconfigcloudextension#SemanticError$value",
25 "com.amazonaws.appconfigcloudextension",
26 "SemanticError",
27 ),
28 ::aws_smithy_schema::ShapeType::String,
29 "value",
30 2,
31);
32static SEMANTICERROR_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
33 ::aws_smithy_schema::ShapeId::from_parts(
34 "com.amazonaws.appconfigcloudextension#SemanticError",
35 "com.amazonaws.appconfigcloudextension",
36 "SemanticError",
37 ),
38 ::aws_smithy_schema::ShapeType::Structure,
39 &[&SEMANTICERROR_MEMBER_PROBLEM, &SEMANTICERROR_MEMBER_ITEM, &SEMANTICERROR_MEMBER_VALUE],
40);
41impl crate::types::SemanticError {
42 pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &SEMANTICERROR_SCHEMA;
44}
45impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::SemanticError {
46 fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
47 Self::SCHEMA
48 }
49
50 #[allow(unused_variables, clippy::diverging_sub_expression)]
51 fn serialize_members(
52 &self,
53 ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
54 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
55 {
56 let val = &self.problem;
57 ser.write_string(&SEMANTICERROR_MEMBER_PROBLEM, val)?;
58 }
59 if let Some(ref val) = self.item {
60 ser.write_string(&SEMANTICERROR_MEMBER_ITEM, val)?;
61 }
62 if let Some(ref val) = self.value {
63 ser.write_string(&SEMANTICERROR_MEMBER_VALUE, val)?;
64 }
65 Ok(())
66 }
67}
68impl crate::types::builders::SemanticErrorBuilder {
69 #[allow(
70 unused_variables,
71 unreachable_code,
72 clippy::single_match,
73 clippy::match_single_binding,
74 clippy::diverging_sub_expression
75 )]
76 pub(crate) fn deserialize_members(
77 &mut self,
78 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
79 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
80 deserializer.read_struct(&SEMANTICERROR_SCHEMA, &mut |member, deser| {
81 match member.member_index() {
82 Some(0) => {
83 self.problem = Some(deser.read_string(member)?);
84 }
85 Some(1) => {
86 if deser.is_null() {
87 deser.read_null()?;
88 } else {
89 self.item = Some(deser.read_string(member)?);
90 }
91 }
92 Some(2) => {
93 if deser.is_null() {
94 deser.read_null()?;
95 } else {
96 self.value = Some(deser.read_string(member)?);
97 }
98 }
99 _ => {}
100 }
101 Ok(())
102 })
103 }
104}
105
106impl crate::types::SemanticError {
107 pub fn deserialize(
109 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
110 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
111 let mut builder = Self::builder();
112 builder.deserialize_members(deserializer)?;
113 builder.problem = builder.problem.or(Some(String::new()));
114 builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
115 }
116}