1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_simple_scalar_properties_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<
|
8 - | crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput,
|
9 - | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError,
|
10 - | > {
|
11 - | #[allow(unused_mut)]
|
12 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 - | .map_err(crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | Err(crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::generic(generic))
|
16 - | }
|
17 - |
|
18 - | #[allow(clippy::unnecessary_wraps)]
|
19 - | pub fn de_simple_scalar_properties_http_response(
|
20 - | _response_status: u16,
|
21 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
22 - | _response_body: &[u8],
|
23 - | ) -> std::result::Result<
|
24 - | crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput,
|
25 - | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError,
|
26 - | > {
|
27 - | Ok({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut output = crate::operation::simple_scalar_properties::builders::SimpleScalarPropertiesOutputBuilder::default();
|
30 - | output = crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(_response_body, output)
|
31 - | .map_err(crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::unhandled)?;
|
32 - | output = output.set_foo(
|
33 - | crate::protocol_serde::shape_simple_scalar_properties_output::de_foo_header(_response_headers).map_err(|_| {
|
34 - | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::unhandled("Failed to parse foo from header `X-Foo")
|
35 - | })?,
|
36 - | );
|
37 - | output.build()
|
38 - | })
|
39 - | }
|
40 - |
|
41 - | pub fn ser_simple_scalar_properties_headers(
|
42 - | input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
43 - | mut builder: ::http_1x::request::Builder,
|
44 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
45 - | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
46 - | let formatted_2 = inner_1.as_str();
|
47 - | let header_value = formatted_2;
|
48 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
49 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
50 - | "foo",
|
51 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
52 - | )
|
53 - | })?;
|
54 - | builder = builder.header("X-Foo", header_value);
|
55 - | }
|
56 - | Ok(builder)
|
57 - | }
|
58 - |
|
59 - | pub fn ser_simple_scalar_properties_input(
|
60 - | input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
61 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
62 - | let mut out = String::new();
|
63 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
64 - | crate::protocol_serde::shape_simple_scalar_properties_input::ser_simple_scalar_properties_input_input(&mut object, input)?;
|
65 - | object.finish();
|
66 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
67 - | }
|
68 - |
|
69 - | pub(crate) fn de_simple_scalar_properties(
|
70 - | _value: &[u8],
|
71 - | mut builder: crate::operation::simple_scalar_properties::builders::SimpleScalarPropertiesOutputBuilder,
|
72 - | ) -> ::std::result::Result<
|
73 - | crate::operation::simple_scalar_properties::builders::SimpleScalarPropertiesOutputBuilder,
|
74 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
75 - | > {
|
76 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
77 - | let tokens = &mut tokens_owned;
|
78 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
79 - | loop {
|
80 - | 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() {
|
83 - | "byteValue" => {
|
84 - | builder = builder.set_byte_value(
|
85 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
86 - | .map(i8::try_from)
|
87 - | .transpose()?,
|
88 - | );
|
89 - | }
|
90 - | "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()));
|
93 - | }
|
94 - | "falseBooleanValue" => {
|
95 - | builder = builder.set_false_boolean_value(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
96 - | }
|
97 - | "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()));
|
100 - | }
|
101 - | "integerValue" => {
|
102 - | builder = builder.set_integer_value(
|
103 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
104 - | .map(i32::try_from)
|
105 - | .transpose()?,
|
106 - | );
|
107 - | }
|
108 - | "longValue" => {
|
109 - | builder = builder.set_long_value(
|
110 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
111 - | .map(i64::try_from)
|
112 - | .transpose()?,
|
113 - | );
|
114 - | }
|
115 - | "shortValue" => {
|
116 - | builder = builder.set_short_value(
|
117 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
118 - | .map(i16::try_from)
|
119 - | .transpose()?,
|
120 - | );
|
121 - | }
|
122 - | "stringValue" => {
|
123 - | builder = builder.set_string_value(
|
124 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
125 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
126 - | .transpose()?,
|
127 - | );
|
128 - | }
|
129 - | "trueBooleanValue" => {
|
130 - | builder = builder.set_true_boolean_value(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
131 - | }
|
132 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
133 - | },
|
134 - | other => {
|
135 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
136 - | "expected object key or end object, found: {other:?}"
|
137 - | )))
|
138 - | }
|
139 - | }
|
140 - | }
|
141 - | if tokens.next().is_some() {
|
142 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
143 - | "found more JSON tokens after completing parsing",
|
144 - | ));
|
145 - | }
|
146 - | Ok(builder)
|
147 - | }
|