1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
pub fn ser_data_label_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::DataLabelOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_1) = &input.visibility {
object.key("Visibility").string(var_1.as_str());
}
if let Some(var_2) = &input.category_label_visibility {
object.key("CategoryLabelVisibility").string(var_2.as_str());
}
if let Some(var_3) = &input.measure_label_visibility {
object.key("MeasureLabelVisibility").string(var_3.as_str());
}
if let Some(var_4) = &input.data_label_types {
let mut array_5 = object.key("DataLabelTypes").start_array();
for item_6 in var_4 {
{
#[allow(unused_mut)]
let mut object_7 = array_5.value().start_object();
crate::protocol_serde::shape_data_label_type::ser_data_label_type(
&mut object_7,
item_6,
)?;
object_7.finish();
}
}
array_5.finish();
}
if let Some(var_8) = &input.position {
object.key("Position").string(var_8.as_str());
}
if let Some(var_9) = &input.label_content {
object.key("LabelContent").string(var_9.as_str());
}
if let Some(var_10) = &input.label_font_configuration {
#[allow(unused_mut)]
let mut object_11 = object.key("LabelFontConfiguration").start_object();
crate::protocol_serde::shape_font_configuration::ser_font_configuration(
&mut object_11,
var_10,
)?;
object_11.finish();
}
if let Some(var_12) = &input.label_color {
object.key("LabelColor").string(var_12.as_str());
}
if let Some(var_13) = &input.overlap {
object.key("Overlap").string(var_13.as_str());
}
Ok(())
}
pub(crate) fn de_data_label_options<'a, I>(
tokens: &mut std::iter::Peekable<I>,
) -> Result<
Option<crate::types::DataLabelOptions>,
aws_smithy_json::deserialize::error::DeserializeError,
>
where
I: Iterator<
Item = Result<
aws_smithy_json::deserialize::Token<'a>,
aws_smithy_json::deserialize::error::DeserializeError,
>,
>,
{
match tokens.next().transpose()? {
Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::DataLabelOptionsBuilder::default();
loop {
match tokens.next().transpose()? {
Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
match key.to_unescaped()?.as_ref() {
"Visibility" => {
builder = builder.set_visibility(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::Visibility::from(u.as_ref()))
})
.transpose()?,
);
}
"CategoryLabelVisibility" => {
builder = builder.set_category_label_visibility(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::Visibility::from(u.as_ref()))
})
.transpose()?,
);
}
"MeasureLabelVisibility" => {
builder = builder.set_measure_label_visibility(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::Visibility::from(u.as_ref()))
})
.transpose()?,
);
}
"DataLabelTypes" => {
builder = builder.set_data_label_types(
crate::protocol_serde::shape_data_label_types::de_data_label_types(tokens)?
);
}
"Position" => {
builder = builder.set_position(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| {
s.to_unescaped().map(|u| {
crate::types::DataLabelPosition::from(u.as_ref())
})
})
.transpose()?,
);
}
"LabelContent" => {
builder = builder.set_label_content(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| {
s.to_unescaped().map(|u| {
crate::types::DataLabelContent::from(u.as_ref())
})
})
.transpose()?,
);
}
"LabelFontConfiguration" => {
builder = builder.set_label_font_configuration(
crate::protocol_serde::shape_font_configuration::de_font_configuration(tokens)?
);
}
"LabelColor" => {
builder = builder.set_label_color(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Overlap" => {
builder = builder.set_overlap(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| {
s.to_unescaped().map(|u| {
crate::types::DataLabelOverlap::from(u.as_ref())
})
})
.transpose()?,
);
}
_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
}
}
other => {
return Err(
aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {:?}",
other
)),
)
}
}
}
Ok(Some(builder.build()))
}
_ => Err(
aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
),
),
}
}