1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:516 */
|
2 3 | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ProtocolParserGenerator.kt:99 */
|
3 5 | pub fn de_simple_scalar_properties_http_error(
|
4 6 | _response_status: u16,
|
5 7 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 8 | _response_body: &[u8],
|
7 9 | ) -> std::result::Result<
|
8 10 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput,
|
9 11 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError,
|
10 12 | > {
|
13 + | /* RustType.kt:516 */
|
11 14 | #[allow(unused_mut)]
|
15 + | /* ProtocolParserGenerator.kt:106 */
|
12 16 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 17 | .map_err(crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::unhandled)?;
|
18 + | /* ProtocolParserGenerator.kt:120 */
|
14 19 | let generic = generic_builder.build();
|
20 + | /* ProtocolParserGenerator.kt:185 */
|
15 21 | Err(crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::generic(generic))
|
22 + | /* ProtocolParserGenerator.kt:99 */
|
16 23 | }
|
17 24 |
|
25 + | /* RustType.kt:516 */
|
18 26 | #[allow(clippy::unnecessary_wraps)]
|
27 + | /* ProtocolParserGenerator.kt:71 */
|
19 28 | pub fn de_simple_scalar_properties_http_response(
|
20 29 | _response_status: u16,
|
21 30 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
22 31 | _response_body: &[u8],
|
23 32 | ) -> std::result::Result<
|
24 33 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput,
|
25 34 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError,
|
26 35 | > {
|
36 + | /* ProtocolParserGenerator.kt:77 */
|
27 37 | Ok({
|
38 + | /* RustType.kt:516 */
|
28 39 | #[allow(unused_mut)]
|
40 + | /* ProtocolParserGenerator.kt:240 */
|
29 41 | let mut output = crate::operation::simple_scalar_properties::builders::SimpleScalarPropertiesOutputBuilder::default();
|
42 + | /* ProtocolParserGenerator.kt:247 */
|
30 43 | output = crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(_response_body, output)
|
31 44 | .map_err(crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::unhandled)?;
|
45 + | /* ProtocolParserGenerator.kt:267 */
|
32 46 | output = output.set_foo(
|
47 + | /* ProtocolParserGenerator.kt:302 */
|
33 48 | crate::protocol_serde::shape_simple_scalar_properties_output::de_foo_header(_response_headers).map_err(|_| {
|
34 49 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::unhandled("Failed to parse foo from header `X-Foo")
|
35 - | })?,
|
50 + | })?, /* ProtocolParserGenerator.kt:267 */
|
36 51 | );
|
52 + | /* ClientBuilderInstantiator.kt:56 */
|
37 53 | output.build()
|
54 + | /* ProtocolParserGenerator.kt:77 */
|
38 55 | })
|
56 + | /* ProtocolParserGenerator.kt:71 */
|
39 57 | }
|
40 58 |
|
59 + | /* HttpBindingGenerator.kt:542 */
|
41 60 | pub fn ser_simple_scalar_properties_headers(
|
42 61 | input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
43 62 | mut builder: ::http::request::Builder,
|
44 63 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
64 + | /* HttpBindingGenerator.kt:592 */
|
45 65 | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
66 + | /* HttpBindingGenerator.kt:704 */
|
46 67 | let formatted_2 = inner_1.as_str();
|
68 + | /* HttpBindingGenerator.kt:706 */
|
47 69 | let header_value = formatted_2;
|
48 70 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
49 71 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
50 72 | "foo",
|
51 73 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
52 74 | )
|
53 75 | })?;
|
54 76 | builder = builder.header("X-Foo", header_value);
|
77 + | /* HttpBindingGenerator.kt:592 */
|
55 78 | }
|
79 + | /* HttpBindingGenerator.kt:555 */
|
56 80 | Ok(builder)
|
81 + | /* HttpBindingGenerator.kt:542 */
|
57 82 | }
|
58 83 |
|
84 + | /* JsonSerializerGenerator.kt:287 */
|
59 85 | pub fn ser_simple_scalar_properties_input(
|
60 86 | input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
61 87 | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
88 + | /* JsonSerializerGenerator.kt:291 */
|
62 89 | let mut out = String::new();
|
90 + | /* JsonSerializerGenerator.kt:292 */
|
63 91 | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
92 + | /* JsonSerializerGenerator.kt:375 */
|
64 93 | crate::protocol_serde::shape_simple_scalar_properties_input::ser_simple_scalar_properties_input_input(&mut object, input)?;
|
94 + | /* JsonSerializerGenerator.kt:295 */
|
65 95 | object.finish();
|
96 + | /* JsonSerializerGenerator.kt:296 */
|
66 97 | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
98 + | /* JsonSerializerGenerator.kt:287 */
|
67 99 | }
|
68 100 |
|
101 + | /* JsonParserGenerator.kt:148 */
|
69 102 | pub(crate) fn de_simple_scalar_properties(
|
70 103 | value: &[u8],
|
71 104 | mut builder: crate::operation::simple_scalar_properties::builders::SimpleScalarPropertiesOutputBuilder,
|
72 105 | ) -> ::std::result::Result<
|
73 106 | crate::operation::simple_scalar_properties::builders::SimpleScalarPropertiesOutputBuilder,
|
74 107 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
75 108 | > {
|
109 + | /* JsonParserGenerator.kt:153 */
|
76 110 | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
|
77 111 | let tokens = &mut tokens_owned;
|
78 112 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
113 + | /* JsonParserGenerator.kt:684 */
|
79 114 | loop {
|
115 + | /* JsonParserGenerator.kt:685 */
|
80 116 | match tokens.next().transpose()? {
|
81 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
82 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
117 + | /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
118 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
119 + | /* JsonParserGenerator.kt:260 */
|
120 + | match key.to_unescaped()?.as_ref() {
|
121 + | /* JsonParserGenerator.kt:262 */
|
83 122 | "byteValue" => {
|
123 + | /* JsonParserGenerator.kt:265 */
|
84 124 | builder = builder.set_byte_value(
|
125 + | /* JsonParserGenerator.kt:365 */
|
85 126 | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
86 127 | .map(i8::try_from)
|
87 - | .transpose()?,
|
128 + | .transpose()?, /* JsonParserGenerator.kt:265 */
|
88 129 | );
|
130 + | /* JsonParserGenerator.kt:262 */
|
89 131 | }
|
132 + | /* JsonParserGenerator.kt:262 */
|
90 133 | "DoubleDribble" => {
|
91 - | builder = builder
|
92 - | .set_double_value(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
|
134 + | /* JsonParserGenerator.kt:265 */
|
135 + | builder = builder.set_double_value(
|
136 + | /* JsonParserGenerator.kt:363 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy())
|
137 + | /* JsonParserGenerator.kt:265 */);
|
138 + | /* JsonParserGenerator.kt:262 */
|
93 139 | }
|
140 + | /* JsonParserGenerator.kt:262 */
|
94 141 | "falseBooleanValue" => {
|
95 - | builder = builder.set_false_boolean_value(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
142 + | /* JsonParserGenerator.kt:265 */
|
143 + | builder = builder.set_false_boolean_value(
|
144 + | /* JsonParserGenerator.kt:298 */
|
145 + | ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
|
146 + | );
|
147 + | /* JsonParserGenerator.kt:262 */
|
96 148 | }
|
149 + | /* JsonParserGenerator.kt:262 */
|
97 150 | "floatValue" => {
|
98 - | builder = builder
|
99 - | .set_float_value(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
|
151 + | /* JsonParserGenerator.kt:265 */
|
152 + | builder = builder.set_float_value(
|
153 + | /* JsonParserGenerator.kt:361 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy())
|
154 + | /* JsonParserGenerator.kt:265 */);
|
155 + | /* JsonParserGenerator.kt:262 */
|
100 156 | }
|
157 + | /* JsonParserGenerator.kt:262 */
|
101 158 | "integerValue" => {
|
159 + | /* JsonParserGenerator.kt:265 */
|
102 160 | builder = builder.set_integer_value(
|
161 + | /* JsonParserGenerator.kt:365 */
|
103 162 | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
104 163 | .map(i32::try_from)
|
105 - | .transpose()?,
|
164 + | .transpose()?, /* JsonParserGenerator.kt:265 */
|
106 165 | );
|
166 + | /* JsonParserGenerator.kt:262 */
|
107 167 | }
|
168 + | /* JsonParserGenerator.kt:262 */
|
108 169 | "longValue" => {
|
170 + | /* JsonParserGenerator.kt:265 */
|
109 171 | builder = builder.set_long_value(
|
172 + | /* JsonParserGenerator.kt:365 */
|
110 173 | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
111 174 | .map(i64::try_from)
|
112 - | .transpose()?,
|
175 + | .transpose()?, /* JsonParserGenerator.kt:265 */
|
113 176 | );
|
177 + | /* JsonParserGenerator.kt:262 */
|
114 178 | }
|
179 + | /* JsonParserGenerator.kt:262 */
|
115 180 | "shortValue" => {
|
181 + | /* JsonParserGenerator.kt:265 */
|
116 182 | builder = builder.set_short_value(
|
183 + | /* JsonParserGenerator.kt:365 */
|
117 184 | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
118 185 | .map(i16::try_from)
|
119 - | .transpose()?,
|
186 + | .transpose()?, /* JsonParserGenerator.kt:265 */
|
120 187 | );
|
188 + | /* JsonParserGenerator.kt:262 */
|
121 189 | }
|
190 + | /* JsonParserGenerator.kt:262 */
|
122 191 | "stringValue" => {
|
192 + | /* JsonParserGenerator.kt:265 */
|
123 193 | builder = builder.set_string_value(
|
194 + | /* JsonParserGenerator.kt:354 */
|
124 195 | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
125 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
126 - | .transpose()?,
|
196 + | .map(|s|
|
197 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
198 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
199 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
200 + | .transpose()?, /* JsonParserGenerator.kt:265 */
|
127 201 | );
|
202 + | /* JsonParserGenerator.kt:262 */
|
128 203 | }
|
204 + | /* JsonParserGenerator.kt:262 */
|
129 205 | "trueBooleanValue" => {
|
130 - | builder = builder.set_true_boolean_value(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
206 + | /* JsonParserGenerator.kt:265 */
|
207 + | builder = builder.set_true_boolean_value(
|
208 + | /* JsonParserGenerator.kt:298 */
|
209 + | ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
|
210 + | );
|
211 + | /* JsonParserGenerator.kt:262 */
|
212 + | }
|
213 + | /* JsonParserGenerator.kt:290 */
|
214 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
131 215 | }
|
132 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
133 - | },
|
216 + | /* JsonParserGenerator.kt:686 */
|
217 + | }
|
218 + | /* JsonParserGenerator.kt:695 */
|
134 219 | other => {
|
135 220 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
136 221 | "expected object key or end object, found: {:?}",
|
137 222 | other
|
138 223 | )))
|
224 + | } /* JsonParserGenerator.kt:685 */
|
139 225 | }
|
226 + | /* JsonParserGenerator.kt:684 */
|
140 227 | }
|
141 - | }
|
228 + | /* JsonParserGenerator.kt:250 */
|
142 229 | if tokens.next().is_some() {
|
230 + | /* JsonParserGenerator.kt:251 */
|
143 231 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
144 232 | "found more JSON tokens after completing parsing",
|
145 233 | ));
|
234 + | /* JsonParserGenerator.kt:250 */
|
146 235 | }
|
236 + | /* JsonParserGenerator.kt:163 */
|
147 237 | Ok(builder)
|
238 + | /* JsonParserGenerator.kt:148 */
|
148 239 | }
|