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::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))?
|
137 - | }
|
187 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
188 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
138 189 | }
|
190 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
139 191 | })
|
192 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
140 193 | }
|
141 194 |
|
195 + | /* JsonParserGenerator.kt:148 */
|
142 196 | pub(crate) fn de_malformed_double(
|
143 197 | value: &[u8],
|
144 198 | mut builder: crate::input::malformed_double_input::Builder,
|
145 199 | ) -> ::std::result::Result<
|
146 200 | crate::input::malformed_double_input::Builder,
|
147 201 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
148 202 | > {
|
203 + | /* JsonParserGenerator.kt:153 */
|
149 204 | let mut tokens_owned =
|
150 205 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
151 206 | .peekable();
|
152 207 | let tokens = &mut tokens_owned;
|
153 208 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
209 + | /* JsonParserGenerator.kt:684 */
|
154 210 | loop {
|
211 + | /* JsonParserGenerator.kt:685 */
|
155 212 | match tokens.next().transpose()? {
|
213 + | /* JsonParserGenerator.kt:686 */
|
156 214 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
157 215 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
216 + | /* JsonParserGenerator.kt:260 */
|
158 217 | match key.to_unescaped()?.as_ref() {
|
218 + | /* JsonParserGenerator.kt:262 */
|
159 219 | "doubleInBody" => {
|
220 + | /* JsonParserGenerator.kt:272 */
|
160 221 | builder = builder.set_double_in_body(
|
222 + | /* JsonParserGenerator.kt:363 */
|
161 223 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
162 224 | tokens.next(),
|
163 225 | )?
|
164 - | .map(|v| v.to_f64_lossy()),
|
226 + | .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
|
165 227 | );
|
228 + | /* JsonParserGenerator.kt:262 */
|
166 229 | }
|
167 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
230 + | /* JsonParserGenerator.kt:290 */
|
231 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
168 232 | }
|
233 + | /* JsonParserGenerator.kt:686 */
|
169 234 | }
|
235 + | /* JsonParserGenerator.kt:695 */
|
170 236 | other => {
|
171 237 | return Err(
|
172 238 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
173 239 | "expected object key or end object, found: {:?}",
|
174 240 | other
|
175 241 | )),
|
176 242 | )
|
177 - | }
|
243 + | } /* JsonParserGenerator.kt:685 */
|
178 244 | }
|
245 + | /* JsonParserGenerator.kt:684 */
|
179 246 | }
|
247 + | /* JsonParserGenerator.kt:250 */
|
180 248 | if tokens.next().is_some() {
|
249 + | /* JsonParserGenerator.kt:251 */
|
181 250 | return Err(
|
182 251 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
183 252 | "found more JSON tokens after completing parsing",
|
184 253 | ),
|
185 254 | );
|
255 + | /* JsonParserGenerator.kt:250 */
|
186 256 | }
|
257 + | /* JsonParserGenerator.kt:163 */
|
187 258 | Ok(builder)
|
259 + | /* JsonParserGenerator.kt:148 */
|
188 260 | }
|