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 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
3 5 | pub async fn de_malformed_double_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::MalformedDoubleInput,
|
7 9 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 10 | >
|
9 11 | where
|
10 12 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11 13 | B::Data: Send,
|
12 14 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 15 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
14 16 | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:516 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:723 */
|
17 22 | let mut input = crate::input::malformed_double_input_internal::Builder::default();
|
23 + | /* RustType.kt:516 */
|
18 24 | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
19 26 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 27 | uri, headers, body, ..
|
21 28 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:745 */
|
22 30 | let bytes = ::hyper::body::to_bytes(body).await?;
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
23 32 | if !bytes.is_empty() {
|
33 + | /* ServerHttpBoundProtocolGenerator.kt:769 */
|
24 34 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
25 35 | &headers,
|
26 36 | Some("application/json"),
|
27 37 | )?;
|
28 38 | input = crate::protocol_serde::shape_malformed_double::de_malformed_double(
|
29 39 | bytes.as_ref(),
|
30 40 | input,
|
31 41 | )?;
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
32 43 | }
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
33 45 | if let Some(value) =
|
34 46 | crate::protocol_serde::shape_malformed_double_input::de_double_in_header_header(
|
35 47 | &headers,
|
36 48 | )?
|
37 49 | {
|
38 50 | input = input.set_double_in_header(Some(value))
|
39 51 | }
|
52 + | /* ServerHttpBoundProtocolGenerator.kt:986 */
|
40 53 | let input_string = uri.path();
|
54 + | /* ServerHttpBoundProtocolGenerator.kt:998 */
|
41 55 | let (input_string, (_, m1)) =
|
42 56 | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
43 57 | ::nom::sequence::preceded(
|
44 58 | ::nom::bytes::complete::tag("/"),
|
45 59 | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
|
46 60 | "MalformedDouble",
|
47 61 | ),
|
48 62 | ),
|
49 63 | ::nom::sequence::preceded(
|
50 64 | ::nom::bytes::complete::tag("/"),
|
51 65 | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
52 66 | ::nom::bytes::complete::take_until("/"),
|
53 67 | ::nom::combinator::rest,
|
54 68 | )),
|
55 69 | ),
|
56 70 | ))(input_string)?;
|
57 71 | debug_assert_eq!("", input_string);
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:1009 */
|
58 73 | input = input.set_double_in_path(
|
59 74 | crate::protocol_serde::shape_malformed_double_input::de_double_in_path(m1)?,
|
60 75 | );
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:1073 */
|
61 77 | let query_string = uri.query().unwrap_or("");
|
62 78 | let pairs = ::form_urlencoded::parse(query_string.as_bytes());
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:1099 */
|
63 80 | let mut double_in_query_seen = false;
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:1105 */
|
64 82 | for (k, v) in pairs {
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:1109 */
|
65 84 | if !double_in_query_seen && k == "doubleInQuery" {
|
66 85 | input = input.set_double_in_query(
|
67 86 | crate::protocol_serde::shape_malformed_double_input::de_double_in_query(&v)?,
|
68 87 | );
|
69 88 | double_in_query_seen = true;
|
70 89 | }
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:1105 */
|
71 91 | }
|
92 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
72 93 | input.build()?
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
73 95 | })
|
96 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
74 97 | }
|
75 98 |
|
99 + | /* RustType.kt:516 */
|
76 100 | #[allow(clippy::unnecessary_wraps)]
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
77 102 | pub fn ser_malformed_double_http_response(
|
78 103 | #[allow(unused_variables)] output: crate::output::MalformedDoubleOutput,
|
79 104 | ) -> std::result::Result<
|
80 105 | ::aws_smithy_http_server::response::Response,
|
81 106 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
82 107 | > {
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
83 109 | Ok({
|
110 + | /* RustType.kt:516 */
|
84 111 | #[allow(unused_mut)]
|
112 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
85 113 | let mut builder = ::http::Response::builder();
|
114 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
86 115 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
87 116 | builder,
|
88 117 | ::http::header::CONTENT_TYPE,
|
89 118 | "application/json",
|
90 119 | );
|
120 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
91 121 | let http_status: u16 = 200;
|
92 122 | builder = builder.status(http_status);
|
93 - | let payload = "";
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
124 + | let payload =
|
125 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */""
|
126 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
94 128 | let content_length = payload.len();
|
95 129 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
96 130 | builder,
|
97 131 | ::http::header::CONTENT_LENGTH,
|
98 132 | content_length,
|
99 133 | );
|
134 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
100 135 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
101 137 | builder.body(body)?
|
138 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
102 139 | })
|
140 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
103 141 | }
|
104 142 |
|
143 + | /* RustType.kt:516 */
|
105 144 | #[allow(clippy::unnecessary_wraps)]
|
145 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
106 146 | pub fn ser_malformed_double_http_error(
|
107 147 | error: &crate::error::MalformedDoubleError,
|
108 148 | ) -> std::result::Result<
|
109 149 | ::aws_smithy_http_server::response::Response,
|
110 150 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
111 151 | > {
|
152 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
112 153 | Ok({
|
154 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
113 155 | match error {
|
156 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
114 157 | crate::error::MalformedDoubleError::ValidationException(output) => {
|
158 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
115 159 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
160 + | /* RustType.kt:516 */
|
116 161 | #[allow(unused_mut)]
|
162 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
117 163 | let mut builder = ::http::Response::builder();
|
164 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
118 165 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
119 166 | builder,
|
120 167 | ::http::header::CONTENT_TYPE,
|
121 168 | "application/json",
|
122 169 | );
|
170 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
123 171 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
124 172 | builder,
|
125 173 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
126 174 | "ValidationException",
|
127 175 | );
|
176 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
128 177 | let content_length = payload.len();
|
129 178 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
130 179 | builder,
|
131 180 | ::http::header::CONTENT_LENGTH,
|
132 181 | content_length,
|
133 182 | );
|
183 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
134 184 | builder
|
135 185 | .status(400)
|
136 186 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
187 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
137 188 | }
|
189 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
138 190 | crate::error::MalformedDoubleError::InternalServerError(output) => {
|
191 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
139 192 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
193 + | /* RustType.kt:516 */
|
140 194 | #[allow(unused_mut)]
|
195 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
141 196 | let mut builder = ::http::Response::builder();
|
197 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
142 198 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
143 199 | builder,
|
144 200 | ::http::header::CONTENT_TYPE,
|
145 201 | "application/json",
|
146 202 | );
|
203 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
147 204 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
148 205 | builder,
|
149 206 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
150 207 | "InternalServerError",
|
151 208 | );
|
209 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
152 210 | let content_length = payload.len();
|
153 211 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
154 212 | builder,
|
155 213 | ::http::header::CONTENT_LENGTH,
|
156 214 | content_length,
|
157 215 | );
|
216 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
158 217 | builder
|
159 218 | .status(500)
|
160 219 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
161 - | }
|
220 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
221 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
162 222 | }
|
223 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
163 224 | })
|
225 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
164 226 | }
|
165 227 |
|
228 + | /* JsonParserGenerator.kt:148 */
|
166 229 | pub(crate) fn de_malformed_double(
|
167 230 | value: &[u8],
|
168 231 | mut builder: crate::input::malformed_double_input_internal::Builder,
|
169 232 | ) -> ::std::result::Result<
|
170 233 | crate::input::malformed_double_input_internal::Builder,
|
171 234 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
172 235 | > {
|
236 + | /* JsonParserGenerator.kt:153 */
|
173 237 | let mut tokens_owned =
|
174 238 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
175 239 | .peekable();
|
176 240 | let tokens = &mut tokens_owned;
|
177 241 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
242 + | /* JsonParserGenerator.kt:684 */
|
178 243 | loop {
|
244 + | /* JsonParserGenerator.kt:685 */
|
179 245 | match tokens.next().transpose()? {
|
246 + | /* JsonParserGenerator.kt:686 */
|
180 247 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
181 248 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
249 + | /* JsonParserGenerator.kt:260 */
|
182 250 | match key.to_unescaped()?.as_ref() {
|
251 + | /* JsonParserGenerator.kt:262 */
|
183 252 | "doubleInBody" => {
|
253 + | /* JsonParserGenerator.kt:272 */
|
184 254 | builder = builder.set_double_in_body(
|
255 + | /* JsonParserGenerator.kt:363 */
|
185 256 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
186 257 | tokens.next(),
|
187 258 | )?
|
188 - | .map(|v| v.to_f64_lossy()),
|
259 + | .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
|
189 260 | );
|
261 + | /* JsonParserGenerator.kt:262 */
|
190 262 | }
|
191 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
263 + | /* JsonParserGenerator.kt:290 */
|
264 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
192 265 | }
|
266 + | /* JsonParserGenerator.kt:686 */
|
193 267 | }
|
268 + | /* JsonParserGenerator.kt:695 */
|
194 269 | other => {
|
195 270 | return Err(
|
196 271 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
197 272 | "expected object key or end object, found: {:?}",
|
198 273 | other
|
199 274 | )),
|
200 275 | )
|
201 - | }
|
276 + | } /* JsonParserGenerator.kt:685 */
|
202 277 | }
|
278 + | /* JsonParserGenerator.kt:684 */
|
203 279 | }
|
280 + | /* JsonParserGenerator.kt:250 */
|
204 281 | if tokens.next().is_some() {
|
282 + | /* JsonParserGenerator.kt:251 */
|
205 283 | return Err(
|
206 284 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
207 285 | "found more JSON tokens after completing parsing",
|
208 286 | ),
|
209 287 | );
|
288 + | /* JsonParserGenerator.kt:250 */
|
210 289 | }
|
290 + | /* JsonParserGenerator.kt:163 */
|
211 291 | Ok(builder)
|
292 + | /* JsonParserGenerator.kt:148 */
|
212 293 | }
|