34 34 | 0,
|
35 35 | )
|
36 36 | .with_http_header("x-field");
|
37 37 | static STRINGHEADEROUTPUT_MEMBER_ENUM_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
38 38 | ::aws_smithy_schema::ShapeId::from_static(
|
39 39 | "aws.protocoltests.restxml.synthetic#StringHeaderOutput$enumHeader",
|
40 40 | "aws.protocoltests.restxml.synthetic",
|
41 41 | "StringHeaderOutput",
|
42 42 | ),
|
43 43 | ::aws_smithy_schema::ShapeType::String,
|
44 - | "enum_header",
|
44 + | "enumHeader",
|
45 45 | 1,
|
46 46 | )
|
47 47 | .with_http_header("x-enum");
|
48 48 | static STRINGHEADEROUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
49 49 | STRINGHEADEROUTPUT_SCHEMA_ID,
|
50 50 | ::aws_smithy_schema::ShapeType::Structure,
|
51 51 | &[&STRINGHEADEROUTPUT_MEMBER_FIELD, &STRINGHEADEROUTPUT_MEMBER_ENUM_HEADER],
|
52 52 | );
|
53 53 | impl StringHeaderOutput {
|
54 54 | /// The schema for this shape.
|
55 55 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &STRINGHEADEROUTPUT_SCHEMA;
|
56 56 | }
|
57 57 | impl ::aws_smithy_schema::serde::SerializableStruct for StringHeaderOutput {
|
58 58 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
59 59 | fn serialize_members(
|
60 60 | &self,
|
61 61 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
62 62 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
63 63 | if let Some(ref val) = self.field {
|
64 64 | ser.write_string(&STRINGHEADEROUTPUT_MEMBER_FIELD, val)?;
|
65 65 | }
|
66 66 | if let Some(ref val) = self.enum_header {
|
67 67 | ser.write_string(&STRINGHEADEROUTPUT_MEMBER_ENUM_HEADER, val.as_str())?;
|
68 68 | }
|
69 69 | Ok(())
|
70 70 | }
|
71 71 | }
|
72 72 | impl StringHeaderOutput {
|
73 73 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
74 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
75 - | deserializer: &mut D,
|
74 + | pub fn deserialize(
|
75 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
76 76 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
77 77 | #[allow(unused_variables, unused_mut)]
|
78 78 | let mut builder = Self::builder();
|
79 79 | #[allow(
|
80 80 | unused_variables,
|
81 81 | unreachable_code,
|
82 82 | clippy::single_match,
|
83 83 | clippy::match_single_binding,
|
84 84 | clippy::diverging_sub_expression
|
85 85 | )]
|
86 - | deserializer.read_struct(&STRINGHEADEROUTPUT_SCHEMA, (), |_, member, deser| {
|
86 + | deserializer.read_struct(&STRINGHEADEROUTPUT_SCHEMA, &mut |member, deser| {
|
87 87 | match member.member_index() {
|
88 88 | Some(0) => {
|
89 89 | builder.field = Some(deser.read_string(member)?);
|
90 90 | }
|
91 91 | Some(1) => {
|
92 92 | builder.enum_header = Some(crate::types::StringEnum::from(deser.read_string(member)?.as_str()));
|
93 93 | }
|
94 94 | _ => {}
|
95 95 | }
|
96 96 | Ok(())
|
97 97 | })?;
|
98 98 | Ok(builder.build())
|
99 99 | }
|
100 100 | }
|
101 + | impl StringHeaderOutput {
|
102 + | /// Deserializes this structure from a body deserializer and HTTP response headers.
|
103 + | /// Header-bound members are read directly from headers, avoiding runtime
|
104 + | /// member iteration overhead. Body members are read via the deserializer.
|
105 + | pub fn deserialize_with_response(
|
106 + | _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
107 + | headers: &::aws_smithy_runtime_api::http::Headers,
|
108 + | _status: u16,
|
109 + | _body: &[u8],
|
110 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
111 + | #[allow(unused_variables, unused_mut)]
|
112 + | let mut builder = Self::builder();
|
113 + | if let Some(val) = headers.get("x-field") {
|
114 + | builder.field = Some(val.to_string());
|
115 + | }
|
116 + | if let Some(val) = headers.get("x-enum") {
|
117 + | builder.enum_header = Some(crate::types::StringEnum::from(val));
|
118 + | }
|
119 + | Ok(builder.build())
|
120 + | }
|
121 + | }
|
101 122 | impl StringHeaderOutput {
|
102 123 | /// Creates a new builder-style object to manufacture [`StringHeaderOutput`](crate::operation::string_header::StringHeaderOutput).
|
103 124 | pub fn builder() -> crate::operation::string_header::builders::StringHeaderOutputBuilder {
|
104 125 | crate::operation::string_header::builders::StringHeaderOutputBuilder::default()
|
105 126 | }
|
106 127 | }
|
107 128 |
|
108 129 | /// A builder for [`StringHeaderOutput`](crate::operation::string_header::StringHeaderOutput).
|
109 130 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
110 131 | #[non_exhaustive]
|
111 132 | pub struct StringHeaderOutputBuilder {
|
112 133 | pub(crate) field: ::std::option::Option<::std::string::String>,
|
113 134 | pub(crate) enum_header: ::std::option::Option<crate::types::StringEnum>,
|
114 135 | }
|
115 136 | impl StringHeaderOutputBuilder {
|
116 137 | #[allow(missing_docs)] // documentation missing in model
|
117 138 | pub fn field(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
118 139 | self.field = ::std::option::Option::Some(input.into());
|
119 140 | self
|
120 141 | }
|
121 142 | #[allow(missing_docs)] // documentation missing in model
|
122 143 | pub fn set_field(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
123 144 | self.field = input;
|
124 145 | self
|
125 146 | }
|
126 147 | #[allow(missing_docs)] // documentation missing in model
|
127 148 | pub fn get_field(&self) -> &::std::option::Option<::std::string::String> {
|
128 149 | &self.field
|
129 150 | }
|
130 151 | #[allow(missing_docs)] // documentation missing in model
|