1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - |
|
3 - | /// Describes one specific validation failure for an input member.
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
4 3 | #[derive(
|
5 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
4 + | ::std::clone::Clone,
|
5 + | ::std::cmp::Eq,
|
6 + | ::std::cmp::Ord,
|
7 + | ::std::cmp::PartialEq,
|
8 + | ::std::cmp::PartialOrd,
|
9 + | ::std::fmt::Debug,
|
10 + | ::std::hash::Hash,
|
6 11 | )]
|
7 - | pub struct ValidationExceptionField {
|
8 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
9 - | pub path: ::std::string::String,
|
10 - | /// A detailed description of the validation failure.
|
11 - | pub message: ::std::string::String,
|
12 - | }
|
13 - | impl ValidationExceptionField {
|
14 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
15 - | pub fn path(&self) -> &str {
|
16 - | use std::ops::Deref;
|
17 - | self.path.deref()
|
18 - | }
|
19 - | /// A detailed description of the validation failure.
|
20 - | pub fn message(&self) -> &str {
|
21 - | use std::ops::Deref;
|
22 - | self.message.deref()
|
23 - | }
|
24 - | }
|
25 - | impl ValidationExceptionField {
|
26 - | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
27 - | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
28 - | crate::model::validation_exception_field::Builder::default()
|
29 - | }
|
30 - | }
|
31 - |
|
32 - | #[allow(missing_docs)] // documentation missing in model
|
33 - | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
34 - | pub enum Events {
|
12 + | pub enum Suit {
|
35 13 | #[allow(missing_docs)] // documentation missing in model
|
36 - | A(crate::model::Event),
|
14 + | Club,
|
37 15 | #[allow(missing_docs)] // documentation missing in model
|
38 - | B(crate::model::Event),
|
16 + | Diamond,
|
39 17 | #[allow(missing_docs)] // documentation missing in model
|
40 - | C(crate::model::Event),
|
18 + | Heart,
|
19 + | #[allow(missing_docs)] // documentation missing in model
|
20 + | Spade,
|
41 21 | }
|
42 - | impl Events {
|
43 - | /// Tries to convert the enum instance into [`A`](crate::model::Events::A), extracting the inner [`Event`](crate::model::Event).
|
44 - | /// Returns `Err(&Self)` if it can't be converted.
|
45 - | pub fn as_a(&self) -> ::std::result::Result<&crate::model::Event, &Self> {
|
46 - | if let Events::A(val) = &self {
|
47 - | ::std::result::Result::Ok(val)
|
48 - | } else {
|
49 - | ::std::result::Result::Err(self)
|
50 - | }
|
51 - | }
|
52 - | /// Returns true if this is a [`A`](crate::model::Events::A).
|
53 - | pub fn is_a(&self) -> bool {
|
54 - | self.as_a().is_ok()
|
22 + | /// See [`Suit`](crate::model::Suit).
|
23 + | pub mod suit {
|
24 + | #[derive(Debug, PartialEq)]
|
25 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
26 + |
|
27 + | impl ::std::fmt::Display for ConstraintViolation {
|
28 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
29 + | write!(
|
30 + | f,
|
31 + | r#"Value provided for 'smithy.protocoltests.rpcv2Cbor#Suit' failed to satisfy constraint: Member must satisfy enum value set: [DIAMOND, CLUB, HEART, SPADE]"#
|
32 + | )
|
55 33 | }
|
56 - | /// Tries to convert the enum instance into [`B`](crate::model::Events::B), extracting the inner [`Event`](crate::model::Event).
|
57 - | /// Returns `Err(&Self)` if it can't be converted.
|
58 - | pub fn as_b(&self) -> ::std::result::Result<&crate::model::Event, &Self> {
|
59 - | if let Events::B(val) = &self {
|
60 - | ::std::result::Result::Ok(val)
|
61 - | } else {
|
62 - | ::std::result::Result::Err(self)
|
63 34 | }
|
35 + |
|
36 + | impl ::std::error::Error for ConstraintViolation {}
|
37 + | impl ConstraintViolation {
|
38 + | pub(crate) fn as_validation_exception_field(
|
39 + | self,
|
40 + | path: ::std::string::String,
|
41 + | ) -> crate::model::ValidationExceptionField {
|
42 + | crate::model::ValidationExceptionField {
|
43 + | message: format!(
|
44 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [DIAMOND, CLUB, HEART, SPADE]"#,
|
45 + | &path
|
46 + | ),
|
47 + | path,
|
64 48 | }
|
65 - | /// Returns true if this is a [`B`](crate::model::Events::B).
|
66 - | pub fn is_b(&self) -> bool {
|
67 - | self.as_b().is_ok()
|
68 49 | }
|
69 - | /// Tries to convert the enum instance into [`C`](crate::model::Events::C), extracting the inner [`Event`](crate::model::Event).
|
70 - | /// Returns `Err(&Self)` if it can't be converted.
|
71 - | pub fn as_c(&self) -> ::std::result::Result<&crate::model::Event, &Self> {
|
72 - | if let Events::C(val) = &self {
|
73 - | ::std::result::Result::Ok(val)
|
74 - | } else {
|
75 - | ::std::result::Result::Err(self)
|
76 50 | }
|
51 + | }
|
52 + | impl ::std::convert::TryFrom<&str> for Suit {
|
53 + | type Error = crate::model::suit::ConstraintViolation;
|
54 + | fn try_from(
|
55 + | s: &str,
|
56 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
57 + | match s {
|
58 + | "CLUB" => Ok(Suit::Club),
|
59 + | "DIAMOND" => Ok(Suit::Diamond),
|
60 + | "HEART" => Ok(Suit::Heart),
|
61 + | "SPADE" => Ok(Suit::Spade),
|
62 + | _ => Err(crate::model::suit::ConstraintViolation(s.to_owned())),
|
77 63 | }
|
78 - | /// Returns true if this is a [`C`](crate::model::Events::C).
|
79 - | pub fn is_c(&self) -> bool {
|
80 - | self.as_c().is_ok()
|
81 64 | }
|
82 65 | }
|
83 - |
|
84 - | #[allow(missing_docs)] // documentation missing in model
|
85 - | #[derive(
|
86 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
87 - | )]
|
88 - | pub struct Event {}
|
89 - | impl Event {
|
90 - | /// Creates a new builder-style object to manufacture [`Event`](crate::model::Event).
|
91 - | pub fn builder() -> crate::model::event::Builder {
|
92 - | crate::model::event::Builder::default()
|
66 + | impl ::std::convert::TryFrom<::std::string::String> for Suit {
|
67 + | type Error = crate::model::suit::ConstraintViolation;
|
68 + | fn try_from(
|
69 + | s: ::std::string::String,
|
70 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
71 + | {
|
72 + | s.as_str().try_into()
|
93 73 | }
|
94 74 | }
|
95 - | impl crate::constrained::Constrained for crate::model::Event {
|
96 - | type Unconstrained = crate::model::event::Builder;
|
97 - | }
|
98 - |
|
99 - | #[allow(missing_docs)] // documentation missing in model
|
100 - | #[derive(
|
101 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
102 - | )]
|
103 - | pub struct RecursiveOperationInputOutputNested1 {
|
104 - | #[allow(missing_docs)] // documentation missing in model
|
105 - | pub foo: ::std::option::Option<::std::string::String>,
|
106 - | #[allow(missing_docs)] // documentation missing in model
|
107 - | pub nested: ::std::option::Option<
|
108 - | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
109 - | >,
|
110 - | #[allow(missing_docs)] // documentation missing in model
|
111 - | pub variant: ::std::option::Option<crate::model::FooChoice>,
|
75 + | impl std::str::FromStr for Suit {
|
76 + | type Err = crate::model::suit::ConstraintViolation;
|
77 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
78 + | Self::try_from(s)
|
79 + | }
|
112 80 | }
|
113 - | impl RecursiveOperationInputOutputNested1 {
|
114 - | #[allow(missing_docs)] // documentation missing in model
|
115 - | pub fn foo(&self) -> ::std::option::Option<&str> {
|
116 - | self.foo.as_deref()
|
81 + | impl Suit {
|
82 + | /// Returns the `&str` value of the enum member.
|
83 + | pub fn as_str(&self) -> &str {
|
84 + | match self {
|
85 + | Suit::Club => "CLUB",
|
86 + | Suit::Diamond => "DIAMOND",
|
87 + | Suit::Heart => "HEART",
|
88 + | Suit::Spade => "SPADE",
|
117 89 | }
|
118 - | #[allow(missing_docs)] // documentation missing in model
|
119 - | pub fn nested(
|
120 - | &self,
|
121 - | ) -> ::std::option::Option<&crate::model::RecursiveOperationInputOutputNested2> {
|
122 - | self.nested.as_deref()
|
123 90 | }
|
124 - | #[allow(missing_docs)] // documentation missing in model
|
125 - | pub fn variant(&self) -> ::std::option::Option<&crate::model::FooChoice> {
|
126 - | self.variant.as_ref()
|
91 + | /// Returns all the `&str` representations of the enum members.
|
92 + | pub const fn values() -> &'static [&'static str] {
|
93 + | &["CLUB", "DIAMOND", "HEART", "SPADE"]
|
127 94 | }
|
128 95 | }
|
129 - | impl RecursiveOperationInputOutputNested1 {
|
130 - | /// Creates a new builder-style object to manufacture [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
131 - | pub fn builder() -> crate::model::recursive_operation_input_output_nested1::Builder {
|
132 - | crate::model::recursive_operation_input_output_nested1::Builder::default()
|
96 + | impl ::std::convert::AsRef<str> for Suit {
|
97 + | fn as_ref(&self) -> &str {
|
98 + | self.as_str()
|
133 99 | }
|
134 100 | }
|
135 - | impl crate::constrained::Constrained for crate::model::RecursiveOperationInputOutputNested1 {
|
136 - | type Unconstrained = crate::model::recursive_operation_input_output_nested1::Builder;
|
101 + | impl crate::constrained::Constrained for Suit {
|
102 + | type Unconstrained = ::std::string::String;
|
137 103 | }
|
138 104 |
|
139 - | #[allow(missing_docs)] // documentation missing in model
|
140 - | #[derive(
|
141 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
142 - | )]
|
143 - | pub enum FooChoice {
|
144 - | #[allow(missing_docs)] // documentation missing in model
|
145 - | Choice1(::std::string::String),
|
146 - | #[allow(missing_docs)] // documentation missing in model
|
147 - | Choice2(::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested1>),
|
148 - | }
|
149 - | impl FooChoice {
|
150 - | /// Tries to convert the enum instance into [`Choice1`](crate::model::FooChoice::Choice1), extracting the inner [`String`](::std::string::String).
|
151 - | /// Returns `Err(&Self)` if it can't be converted.
|
152 - | pub fn as_choice1(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
153 - | if let FooChoice::Choice1(val) = &self {
|
154 - | ::std::result::Result::Ok(val)
|
155 - | } else {
|
156 - | ::std::result::Result::Err(self)
|
157 - | }
|
158 - | }
|
159 - | /// Returns true if this is a [`Choice1`](crate::model::FooChoice::Choice1).
|
160 - | pub fn is_choice1(&self) -> bool {
|
161 - | self.as_choice1().is_ok()
|
162 - | }
|
163 - | /// Tries to convert the enum instance into [`Choice2`](crate::model::FooChoice::Choice2), extracting the inner [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
164 - | /// Returns `Err(&Self)` if it can't be converted.
|
165 - | pub fn as_choice2(
|
166 - | &self,
|
167 - | ) -> ::std::result::Result<
|
168 - | &::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested1>,
|
169 - | &Self,
|
170 - | > {
|
171 - | if let FooChoice::Choice2(val) = &self {
|
172 - | ::std::result::Result::Ok(val)
|
173 - | } else {
|
174 - | ::std::result::Result::Err(self)
|
175 - | }
|
176 - | }
|
177 - | /// Returns true if this is a [`Choice2`](crate::model::FooChoice::Choice2).
|
178 - | pub fn is_choice2(&self) -> bool {
|
179 - | self.as_choice2().is_ok()
|
105 + | impl ::std::convert::From<::std::string::String>
|
106 + | for crate::constrained::MaybeConstrained<crate::model::Suit>
|
107 + | {
|
108 + | fn from(value: ::std::string::String) -> Self {
|
109 + | Self::Unconstrained(value)
|
180 110 | }
|
181 111 | }
|
182 112 |
|
183 113 | #[allow(missing_docs)] // documentation missing in model
|
184 - | #[derive(
|
185 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
186 - | )]
|
187 - | pub struct RecursiveOperationInputOutputNested2 {
|
114 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
115 + | pub struct SimpleStruct {
|
188 116 | #[allow(missing_docs)] // documentation missing in model
|
189 - | pub bar: ::std::option::Option<::std::string::String>,
|
117 + | pub blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
190 118 | #[allow(missing_docs)] // documentation missing in model
|
191 - | pub recursive_member: ::std::option::Option<crate::model::RecursiveOperationInputOutputNested1>,
|
192 - | }
|
193 - | impl RecursiveOperationInputOutputNested2 {
|
119 + | pub boolean: ::std::option::Option<bool>,
|
194 120 | #[allow(missing_docs)] // documentation missing in model
|
195 - | pub fn bar(&self) -> ::std::option::Option<&str> {
|
196 - | self.bar.as_deref()
|
197 - | }
|
198 - | #[allow(missing_docs)] // documentation missing in model
|
199 - | pub fn recursive_member(
|
200 - | &self,
|
201 - | ) -> ::std::option::Option<&crate::model::RecursiveOperationInputOutputNested1> {
|
202 - | self.recursive_member.as_ref()
|
203 - | }
|
204 - | }
|
205 - | impl RecursiveOperationInputOutputNested2 {
|
206 - | /// Creates a new builder-style object to manufacture [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
207 - | pub fn builder() -> crate::model::recursive_operation_input_output_nested2::Builder {
|
208 - | crate::model::recursive_operation_input_output_nested2::Builder::default()
|
209 - | }
|
210 - | }
|
211 - | impl crate::constrained::Constrained for crate::model::RecursiveOperationInputOutputNested2 {
|
212 - | type Unconstrained = crate::model::recursive_operation_input_output_nested2::Builder;
|
213 - | }
|
214 - |
|
215 - | #[allow(missing_docs)] // documentation missing in model
|
216 - | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
217 - | pub enum ComplexUnion {
|
218 - | #[allow(missing_docs)] // documentation missing in model
|
219 - | ComplexStruct(crate::model::ComplexStruct),
|
220 - | #[allow(missing_docs)] // documentation missing in model
|
221 - | List(::std::vec::Vec<::std::string::String>),
|
222 - | #[allow(missing_docs)] // documentation missing in model
|
223 - | Map(::std::collections::HashMap<::std::string::String, i32>),
|
224 - | #[allow(missing_docs)] // documentation missing in model
|
225 - | Structure(crate::model::SimpleStruct),
|
226 - | #[allow(missing_docs)] // documentation missing in model
|
227 - | Union(crate::model::SimpleUnion),
|
228 - | }
|
229 - | impl ComplexUnion {
|
230 - | /// Tries to convert the enum instance into [`ComplexStruct`](crate::model::ComplexUnion::ComplexStruct), extracting the inner [`ComplexStruct`](crate::model::ComplexStruct).
|
231 - | /// Returns `Err(&Self)` if it can't be converted.
|
232 - | pub fn as_complex_struct(&self) -> ::std::result::Result<&crate::model::ComplexStruct, &Self> {
|
233 - | if let ComplexUnion::ComplexStruct(val) = &self {
|
234 - | ::std::result::Result::Ok(val)
|
235 - | } else {
|
236 - | ::std::result::Result::Err(self)
|
237 - | }
|
238 - | }
|
239 - | /// Returns true if this is a [`ComplexStruct`](crate::model::ComplexUnion::ComplexStruct).
|
240 - | pub fn is_complex_struct(&self) -> bool {
|
241 - | self.as_complex_struct().is_ok()
|
242 - | }
|
243 - | /// Tries to convert the enum instance into [`List`](crate::model::ComplexUnion::List), extracting the inner [`Vec`](::std::vec::Vec).
|
244 - | /// Returns `Err(&Self)` if it can't be converted.
|
245 - | pub fn as_list(&self) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
246 - | if let ComplexUnion::List(val) = &self {
|
247 - | ::std::result::Result::Ok(val)
|
248 - | } else {
|
249 - | ::std::result::Result::Err(self)
|
250 - | }
|
251 - | }
|
252 - | /// Returns true if this is a [`List`](crate::model::ComplexUnion::List).
|
253 - | pub fn is_list(&self) -> bool {
|
254 - | self.as_list().is_ok()
|
255 - | }
|
256 - | /// Tries to convert the enum instance into [`Map`](crate::model::ComplexUnion::Map), extracting the inner [`HashMap`](::std::collections::HashMap).
|
257 - | /// Returns `Err(&Self)` if it can't be converted.
|
258 - | pub fn as_map(
|
259 - | &self,
|
260 - | ) -> ::std::result::Result<&::std::collections::HashMap<::std::string::String, i32>, &Self>
|
261 - | {
|
262 - | if let ComplexUnion::Map(val) = &self {
|
263 - | ::std::result::Result::Ok(val)
|
264 - | } else {
|
265 - | ::std::result::Result::Err(self)
|
266 - | }
|
267 - | }
|
268 - | /// Returns true if this is a [`Map`](crate::model::ComplexUnion::Map).
|
269 - | pub fn is_map(&self) -> bool {
|
270 - | self.as_map().is_ok()
|
271 - | }
|
272 - | /// Tries to convert the enum instance into [`Structure`](crate::model::ComplexUnion::Structure), extracting the inner [`SimpleStruct`](crate::model::SimpleStruct).
|
273 - | /// Returns `Err(&Self)` if it can't be converted.
|
274 - | pub fn as_structure(&self) -> ::std::result::Result<&crate::model::SimpleStruct, &Self> {
|
275 - | if let ComplexUnion::Structure(val) = &self {
|
276 - | ::std::result::Result::Ok(val)
|
277 - | } else {
|
278 - | ::std::result::Result::Err(self)
|
279 - | }
|
280 - | }
|
281 - | /// Returns true if this is a [`Structure`](crate::model::ComplexUnion::Structure).
|
282 - | pub fn is_structure(&self) -> bool {
|
283 - | self.as_structure().is_ok()
|
284 - | }
|
285 - | /// Tries to convert the enum instance into [`Union`](crate::model::ComplexUnion::Union), extracting the inner [`SimpleUnion`](crate::model::SimpleUnion).
|
286 - | /// Returns `Err(&Self)` if it can't be converted.
|
287 - | pub fn as_union(&self) -> ::std::result::Result<&crate::model::SimpleUnion, &Self> {
|
288 - | if let ComplexUnion::Union(val) = &self {
|
289 - | ::std::result::Result::Ok(val)
|
290 - | } else {
|
291 - | ::std::result::Result::Err(self)
|
292 - | }
|
293 - | }
|
294 - | /// Returns true if this is a [`Union`](crate::model::ComplexUnion::Union).
|
295 - | pub fn is_union(&self) -> bool {
|
296 - | self.as_union().is_ok()
|
297 - | }
|
298 - | }
|
299 - |
|
300 - | #[allow(missing_docs)] // documentation missing in model
|
301 - | #[derive(
|
302 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
303 - | )]
|
304 - | pub enum SimpleUnion {
|
305 - | #[allow(missing_docs)] // documentation missing in model
|
306 - | Blob(::aws_smithy_types::Blob),
|
307 - | #[allow(missing_docs)] // documentation missing in model
|
308 - | Boolean(bool),
|
309 - | #[allow(missing_docs)] // documentation missing in model
|
310 - | String(::std::string::String),
|
311 - | #[allow(missing_docs)] // documentation missing in model
|
312 - | Unit,
|
313 - | }
|
314 - | impl SimpleUnion {
|
315 - | /// Tries to convert the enum instance into [`Blob`](crate::model::SimpleUnion::Blob), extracting the inner [`Blob`](::aws_smithy_types::Blob).
|
316 - | /// Returns `Err(&Self)` if it can't be converted.
|
317 - | pub fn as_blob(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
|
318 - | if let SimpleUnion::Blob(val) = &self {
|
319 - | ::std::result::Result::Ok(val)
|
320 - | } else {
|
321 - | ::std::result::Result::Err(self)
|
322 - | }
|
323 - | }
|
324 - | /// Returns true if this is a [`Blob`](crate::model::SimpleUnion::Blob).
|
325 - | pub fn is_blob(&self) -> bool {
|
326 - | self.as_blob().is_ok()
|
327 - | }
|
328 - | /// Tries to convert the enum instance into [`Boolean`](crate::model::SimpleUnion::Boolean), extracting the inner [`bool`](bool).
|
329 - | /// Returns `Err(&Self)` if it can't be converted.
|
330 - | pub fn as_boolean(&self) -> ::std::result::Result<&bool, &Self> {
|
331 - | if let SimpleUnion::Boolean(val) = &self {
|
332 - | ::std::result::Result::Ok(val)
|
333 - | } else {
|
334 - | ::std::result::Result::Err(self)
|
335 - | }
|
336 - | }
|
337 - | /// Returns true if this is a [`Boolean`](crate::model::SimpleUnion::Boolean).
|
338 - | pub fn is_boolean(&self) -> bool {
|
339 - | self.as_boolean().is_ok()
|
340 - | }
|
341 - | /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
|
342 - | /// Returns `Err(&Self)` if it can't be converted.
|
343 - | pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
344 - | if let SimpleUnion::String(val) = &self {
|
345 - | ::std::result::Result::Ok(val)
|
346 - | } else {
|
347 - | ::std::result::Result::Err(self)
|
348 - | }
|
349 - | }
|
350 - | /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
|
351 - | pub fn is_string(&self) -> bool {
|
352 - | self.as_string().is_ok()
|
353 - | }
|
354 - | /// Tries to convert the enum instance into [`Unit`](crate::model::SimpleUnion::Unit), extracting the inner `()`.
|
355 - | /// Returns `Err(&Self)` if it can't be converted.
|
356 - | pub fn as_unit(&self) -> ::std::result::Result<(), &Self> {
|
357 - | if let SimpleUnion::Unit = &self {
|
358 - | ::std::result::Result::Ok(())
|
359 - | } else {
|
360 - | ::std::result::Result::Err(self)
|
361 - | }
|
362 - | }
|
363 - | /// Returns true if this is a [`Unit`](crate::model::SimpleUnion::Unit).
|
364 - | pub fn is_unit(&self) -> bool {
|
365 - | self.as_unit().is_ok()
|
366 - | }
|
367 - | }
|
368 - |
|
369 - | #[allow(missing_docs)] // documentation missing in model
|
370 - | #[derive(
|
371 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
372 - | )]
|
373 - | pub struct Unit {}
|
374 - | impl Unit {
|
375 - | /// Creates a new builder-style object to manufacture [`Unit`](crate::model::Unit).
|
376 - | pub fn builder() -> crate::model::unit::Builder {
|
377 - | crate::model::unit::Builder::default()
|
378 - | }
|
379 - | }
|
380 - | impl crate::constrained::Constrained for crate::model::Unit {
|
381 - | type Unconstrained = crate::model::unit::Builder;
|
382 - | }
|
383 - |
|
384 - | #[allow(missing_docs)] // documentation missing in model
|
385 - | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
386 - | pub struct SimpleStruct {
|
387 - | #[allow(missing_docs)] // documentation missing in model
|
388 - | pub blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
389 - | #[allow(missing_docs)] // documentation missing in model
|
390 - | pub boolean: ::std::option::Option<bool>,
|
391 - | #[allow(missing_docs)] // documentation missing in model
|
392 - | pub string: ::std::option::Option<::std::string::String>,
|
121 + | pub string: ::std::option::Option<::std::string::String>,
|
393 122 | #[allow(missing_docs)] // documentation missing in model
|
394 123 | pub byte: ::std::option::Option<i8>,
|
395 124 | #[allow(missing_docs)] // documentation missing in model
|
396 125 | pub short: ::std::option::Option<i16>,
|
397 126 | #[allow(missing_docs)] // documentation missing in model
|
398 127 | pub integer: ::std::option::Option<i32>,
|
399 128 | #[allow(missing_docs)] // documentation missing in model
|
400 129 | pub long: ::std::option::Option<i64>,
|
401 130 | #[allow(missing_docs)] // documentation missing in model
|
402 131 | pub float: ::std::option::Option<f32>,
|
525 254 | pub fn builder() -> crate::model::simple_struct::Builder {
|
526 255 | crate::model::simple_struct::Builder::default()
|
527 256 | }
|
528 257 | }
|
529 258 | impl crate::constrained::Constrained for crate::model::SimpleStruct {
|
530 259 | type Unconstrained = crate::model::simple_struct::Builder;
|
531 260 | }
|
532 261 |
|
533 262 | #[allow(missing_docs)] // documentation missing in model
|
534 263 | #[derive(
|
535 - | ::std::clone::Clone,
|
536 - | ::std::cmp::Eq,
|
537 - | ::std::cmp::Ord,
|
538 - | ::std::cmp::PartialEq,
|
539 - | ::std::cmp::PartialOrd,
|
540 - | ::std::fmt::Debug,
|
541 - | ::std::hash::Hash,
|
264 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
542 265 | )]
|
543 - | pub enum Suit {
|
266 + | pub struct EmptyStruct {}
|
267 + | impl EmptyStruct {
|
268 + | /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::model::EmptyStruct).
|
269 + | pub fn builder() -> crate::model::empty_struct::Builder {
|
270 + | crate::model::empty_struct::Builder::default()
|
271 + | }
|
272 + | }
|
273 + | impl crate::constrained::Constrained for crate::model::EmptyStruct {
|
274 + | type Unconstrained = crate::model::empty_struct::Builder;
|
275 + | }
|
276 + |
|
277 + | #[allow(missing_docs)] // documentation missing in model
|
278 + | #[derive(
|
279 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
280 + | )]
|
281 + | pub enum SimpleUnion {
|
544 282 | #[allow(missing_docs)] // documentation missing in model
|
545 - | Club,
|
283 + | Blob(::aws_smithy_types::Blob),
|
546 284 | #[allow(missing_docs)] // documentation missing in model
|
547 - | Diamond,
|
285 + | Boolean(bool),
|
548 286 | #[allow(missing_docs)] // documentation missing in model
|
549 - | Heart,
|
287 + | String(::std::string::String),
|
550 288 | #[allow(missing_docs)] // documentation missing in model
|
551 - | Spade,
|
289 + | Unit,
|
552 290 | }
|
553 - | /// See [`Suit`](crate::model::Suit).
|
554 - | pub mod suit {
|
555 - | #[derive(Debug, PartialEq)]
|
556 - | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
557 - |
|
558 - | impl ::std::fmt::Display for ConstraintViolation {
|
559 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
560 - | write!(
|
561 - | f,
|
562 - | r#"Value provided for 'smithy.protocoltests.rpcv2Cbor#Suit' failed to satisfy constraint: Member must satisfy enum value set: [DIAMOND, CLUB, HEART, SPADE]"#
|
563 - | )
|
291 + | impl SimpleUnion {
|
292 + | /// Tries to convert the enum instance into [`Blob`](crate::model::SimpleUnion::Blob), extracting the inner [`Blob`](::aws_smithy_types::Blob).
|
293 + | /// Returns `Err(&Self)` if it can't be converted.
|
294 + | pub fn as_blob(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
|
295 + | if let SimpleUnion::Blob(val) = &self {
|
296 + | ::std::result::Result::Ok(val)
|
297 + | } else {
|
298 + | ::std::result::Result::Err(self)
|
564 299 | }
|
565 300 | }
|
566 - |
|
567 - | impl ::std::error::Error for ConstraintViolation {}
|
568 - | impl ConstraintViolation {
|
569 - | pub(crate) fn as_validation_exception_field(
|
570 - | self,
|
571 - | path: ::std::string::String,
|
572 - | ) -> crate::model::ValidationExceptionField {
|
573 - | crate::model::ValidationExceptionField {
|
574 - | message: format!(
|
575 - | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [DIAMOND, CLUB, HEART, SPADE]"#,
|
576 - | &path
|
577 - | ),
|
578 - | path,
|
579 - | }
|
301 + | /// Returns true if this is a [`Blob`](crate::model::SimpleUnion::Blob).
|
302 + | pub fn is_blob(&self) -> bool {
|
303 + | self.as_blob().is_ok()
|
580 304 | }
|
305 + | /// Tries to convert the enum instance into [`Boolean`](crate::model::SimpleUnion::Boolean), extracting the inner [`bool`](bool).
|
306 + | /// Returns `Err(&Self)` if it can't be converted.
|
307 + | pub fn as_boolean(&self) -> ::std::result::Result<&bool, &Self> {
|
308 + | if let SimpleUnion::Boolean(val) = &self {
|
309 + | ::std::result::Result::Ok(val)
|
310 + | } else {
|
311 + | ::std::result::Result::Err(self)
|
581 312 | }
|
582 - | }
|
583 - | impl ::std::convert::TryFrom<&str> for Suit {
|
584 - | type Error = crate::model::suit::ConstraintViolation;
|
585 - | fn try_from(
|
586 - | s: &str,
|
587 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
588 - | match s {
|
589 - | "CLUB" => Ok(Suit::Club),
|
590 - | "DIAMOND" => Ok(Suit::Diamond),
|
591 - | "HEART" => Ok(Suit::Heart),
|
592 - | "SPADE" => Ok(Suit::Spade),
|
593 - | _ => Err(crate::model::suit::ConstraintViolation(s.to_owned())),
|
594 313 | }
|
314 + | /// Returns true if this is a [`Boolean`](crate::model::SimpleUnion::Boolean).
|
315 + | pub fn is_boolean(&self) -> bool {
|
316 + | self.as_boolean().is_ok()
|
595 317 | }
|
596 - | }
|
597 - | impl ::std::convert::TryFrom<::std::string::String> for Suit {
|
598 - | type Error = crate::model::suit::ConstraintViolation;
|
599 - | fn try_from(
|
600 - | s: ::std::string::String,
|
601 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
602 - | {
|
603 - | s.as_str().try_into()
|
318 + | /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
|
319 + | /// Returns `Err(&Self)` if it can't be converted.
|
320 + | pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
321 + | if let SimpleUnion::String(val) = &self {
|
322 + | ::std::result::Result::Ok(val)
|
323 + | } else {
|
324 + | ::std::result::Result::Err(self)
|
604 325 | }
|
605 - | }
|
606 - | impl std::str::FromStr for Suit {
|
607 - | type Err = crate::model::suit::ConstraintViolation;
|
608 - | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
609 - | Self::try_from(s)
|
610 326 | }
|
611 - | }
|
612 - | impl Suit {
|
613 - | /// Returns the `&str` value of the enum member.
|
614 - | pub fn as_str(&self) -> &str {
|
615 - | match self {
|
616 - | Suit::Club => "CLUB",
|
617 - | Suit::Diamond => "DIAMOND",
|
618 - | Suit::Heart => "HEART",
|
619 - | Suit::Spade => "SPADE",
|
327 + | /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
|
328 + | pub fn is_string(&self) -> bool {
|
329 + | self.as_string().is_ok()
|
620 330 | }
|
331 + | /// Tries to convert the enum instance into [`Unit`](crate::model::SimpleUnion::Unit), extracting the inner `()`.
|
332 + | /// Returns `Err(&Self)` if it can't be converted.
|
333 + | pub fn as_unit(&self) -> ::std::result::Result<(), &Self> {
|
334 + | if let SimpleUnion::Unit = &self {
|
335 + | ::std::result::Result::Ok(())
|
336 + | } else {
|
337 + | ::std::result::Result::Err(self)
|
621 338 | }
|
622 - | /// Returns all the `&str` representations of the enum members.
|
623 - | pub const fn values() -> &'static [&'static str] {
|
624 - | &["CLUB", "DIAMOND", "HEART", "SPADE"]
|
625 339 | }
|
626 - | }
|
627 - | impl ::std::convert::AsRef<str> for Suit {
|
628 - | fn as_ref(&self) -> &str {
|
629 - | self.as_str()
|
340 + | /// Returns true if this is a [`Unit`](crate::model::SimpleUnion::Unit).
|
341 + | pub fn is_unit(&self) -> bool {
|
342 + | self.as_unit().is_ok()
|
630 343 | }
|
631 344 | }
|
632 - | impl crate::constrained::Constrained for Suit {
|
633 - | type Unconstrained = ::std::string::String;
|
634 - | }
|
635 345 |
|
636 - | impl ::std::convert::From<::std::string::String>
|
637 - | for crate::constrained::MaybeConstrained<crate::model::Suit>
|
638 - | {
|
639 - | fn from(value: ::std::string::String) -> Self {
|
640 - | Self::Unconstrained(value)
|
346 + | #[allow(missing_docs)] // documentation missing in model
|
347 + | #[derive(
|
348 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
349 + | )]
|
350 + | pub enum UnitUnion {
|
351 + | #[allow(missing_docs)] // documentation missing in model
|
352 + | UnitA,
|
353 + | #[allow(missing_docs)] // documentation missing in model
|
354 + | UnitB,
|
355 + | }
|
356 + | impl UnitUnion {
|
357 + | /// Tries to convert the enum instance into [`UnitA`](crate::model::UnitUnion::UnitA), extracting the inner `()`.
|
358 + | /// Returns `Err(&Self)` if it can't be converted.
|
359 + | pub fn as_unit_a(&self) -> ::std::result::Result<(), &Self> {
|
360 + | if let UnitUnion::UnitA = &self {
|
361 + | ::std::result::Result::Ok(())
|
362 + | } else {
|
363 + | ::std::result::Result::Err(self)
|
364 + | }
|
365 + | }
|
366 + | /// Returns true if this is a [`UnitA`](crate::model::UnitUnion::UnitA).
|
367 + | pub fn is_unit_a(&self) -> bool {
|
368 + | self.as_unit_a().is_ok()
|
369 + | }
|
370 + | /// Tries to convert the enum instance into [`UnitB`](crate::model::UnitUnion::UnitB), extracting the inner `()`.
|
371 + | /// Returns `Err(&Self)` if it can't be converted.
|
372 + | pub fn as_unit_b(&self) -> ::std::result::Result<(), &Self> {
|
373 + | if let UnitUnion::UnitB = &self {
|
374 + | ::std::result::Result::Ok(())
|
375 + | } else {
|
376 + | ::std::result::Result::Err(self)
|
377 + | }
|
378 + | }
|
379 + | /// Returns true if this is a [`UnitB`](crate::model::UnitUnion::UnitB).
|
380 + | pub fn is_unit_b(&self) -> bool {
|
381 + | self.as_unit_b().is_ok()
|
641 382 | }
|
642 383 | }
|
643 384 |
|
644 385 | #[allow(missing_docs)] // documentation missing in model
|
645 386 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
646 - | pub struct ComplexStruct {
|
647 - | #[allow(missing_docs)] // documentation missing in model
|
648 - | pub structure: ::std::option::Option<crate::model::SimpleStruct>,
|
387 + | pub enum ComplexUnion {
|
649 388 | #[allow(missing_docs)] // documentation missing in model
|
650 - | pub empty_structure: ::std::option::Option<crate::model::EmptyStruct>,
|
389 + | ComplexStruct(crate::model::ComplexStruct),
|
651 390 | #[allow(missing_docs)] // documentation missing in model
|
652 - | pub list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
391 + | List(::std::vec::Vec<::std::string::String>),
|
653 392 | #[allow(missing_docs)] // documentation missing in model
|
654 - | pub map: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
|
393 + | Map(::std::collections::HashMap<::std::string::String, i32>),
|
655 394 | #[allow(missing_docs)] // documentation missing in model
|
656 - | pub union: ::std::option::Option<crate::model::SimpleUnion>,
|
395 + | Structure(crate::model::SimpleStruct),
|
657 396 | #[allow(missing_docs)] // documentation missing in model
|
658 - | pub unit_union: ::std::option::Option<crate::model::UnitUnion>,
|
397 + | Union(crate::model::SimpleUnion),
|
398 + | }
|
399 + | impl ComplexUnion {
|
400 + | /// Tries to convert the enum instance into [`ComplexStruct`](crate::model::ComplexUnion::ComplexStruct), extracting the inner [`ComplexStruct`](crate::model::ComplexStruct).
|
401 + | /// Returns `Err(&Self)` if it can't be converted.
|
402 + | pub fn as_complex_struct(&self) -> ::std::result::Result<&crate::model::ComplexStruct, &Self> {
|
403 + | if let ComplexUnion::ComplexStruct(val) = &self {
|
404 + | ::std::result::Result::Ok(val)
|
405 + | } else {
|
406 + | ::std::result::Result::Err(self)
|
407 + | }
|
408 + | }
|
409 + | /// Returns true if this is a [`ComplexStruct`](crate::model::ComplexUnion::ComplexStruct).
|
410 + | pub fn is_complex_struct(&self) -> bool {
|
411 + | self.as_complex_struct().is_ok()
|
412 + | }
|
413 + | /// Tries to convert the enum instance into [`List`](crate::model::ComplexUnion::List), extracting the inner [`Vec`](::std::vec::Vec).
|
414 + | /// Returns `Err(&Self)` if it can't be converted.
|
415 + | pub fn as_list(&self) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
416 + | if let ComplexUnion::List(val) = &self {
|
417 + | ::std::result::Result::Ok(val)
|
418 + | } else {
|
419 + | ::std::result::Result::Err(self)
|
420 + | }
|
421 + | }
|
422 + | /// Returns true if this is a [`List`](crate::model::ComplexUnion::List).
|
423 + | pub fn is_list(&self) -> bool {
|
424 + | self.as_list().is_ok()
|
425 + | }
|
426 + | /// Tries to convert the enum instance into [`Map`](crate::model::ComplexUnion::Map), extracting the inner [`HashMap`](::std::collections::HashMap).
|
427 + | /// Returns `Err(&Self)` if it can't be converted.
|
428 + | pub fn as_map(
|
429 + | &self,
|
430 + | ) -> ::std::result::Result<&::std::collections::HashMap<::std::string::String, i32>, &Self>
|
431 + | {
|
432 + | if let ComplexUnion::Map(val) = &self {
|
433 + | ::std::result::Result::Ok(val)
|
434 + | } else {
|
435 + | ::std::result::Result::Err(self)
|
436 + | }
|
437 + | }
|
438 + | /// Returns true if this is a [`Map`](crate::model::ComplexUnion::Map).
|
439 + | pub fn is_map(&self) -> bool {
|
440 + | self.as_map().is_ok()
|
441 + | }
|
442 + | /// Tries to convert the enum instance into [`Structure`](crate::model::ComplexUnion::Structure), extracting the inner [`SimpleStruct`](crate::model::SimpleStruct).
|
443 + | /// Returns `Err(&Self)` if it can't be converted.
|
444 + | pub fn as_structure(&self) -> ::std::result::Result<&crate::model::SimpleStruct, &Self> {
|
445 + | if let ComplexUnion::Structure(val) = &self {
|
446 + | ::std::result::Result::Ok(val)
|
447 + | } else {
|
448 + | ::std::result::Result::Err(self)
|
449 + | }
|
450 + | }
|
451 + | /// Returns true if this is a [`Structure`](crate::model::ComplexUnion::Structure).
|
452 + | pub fn is_structure(&self) -> bool {
|
453 + | self.as_structure().is_ok()
|
454 + | }
|
455 + | /// Tries to convert the enum instance into [`Union`](crate::model::ComplexUnion::Union), extracting the inner [`SimpleUnion`](crate::model::SimpleUnion).
|
456 + | /// Returns `Err(&Self)` if it can't be converted.
|
457 + | pub fn as_union(&self) -> ::std::result::Result<&crate::model::SimpleUnion, &Self> {
|
458 + | if let ComplexUnion::Union(val) = &self {
|
459 + | ::std::result::Result::Ok(val)
|
460 + | } else {
|
461 + | ::std::result::Result::Err(self)
|
462 + | }
|
463 + | }
|
464 + | /// Returns true if this is a [`Union`](crate::model::ComplexUnion::Union).
|
465 + | pub fn is_union(&self) -> bool {
|
466 + | self.as_union().is_ok()
|
467 + | }
|
468 + | }
|
469 + |
|
470 + | #[allow(missing_docs)] // documentation missing in model
|
471 + | #[derive(
|
472 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
473 + | )]
|
474 + | pub struct RecursiveOperationInputOutputNested1 {
|
659 475 | #[allow(missing_docs)] // documentation missing in model
|
660 - | pub structure_list: ::std::option::Option<::std::vec::Vec<crate::model::SimpleStruct>>,
|
476 + | pub foo: ::std::option::Option<::std::string::String>,
|
661 477 | #[allow(missing_docs)] // documentation missing in model
|
662 - | pub complex_list: ::std::vec::Vec<
|
663 - | ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
478 + | pub nested: ::std::option::Option<
|
479 + | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
664 480 | >,
|
665 481 | #[allow(missing_docs)] // documentation missing in model
|
666 - | pub complex_map: ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
482 + | pub variant: ::std::option::Option<crate::model::FooChoice>,
|
483 + | }
|
484 + | impl RecursiveOperationInputOutputNested1 {
|
667 485 | #[allow(missing_docs)] // documentation missing in model
|
668 - | pub complex_union: ::std::boxed::Box<crate::model::ComplexUnion>,
|
486 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
487 + | self.foo.as_deref()
|
488 + | }
|
489 + | #[allow(missing_docs)] // documentation missing in model
|
490 + | pub fn nested(
|
491 + | &self,
|
492 + | ) -> ::std::option::Option<&crate::model::RecursiveOperationInputOutputNested2> {
|
493 + | self.nested.as_deref()
|
494 + | }
|
495 + | #[allow(missing_docs)] // documentation missing in model
|
496 + | pub fn variant(&self) -> ::std::option::Option<&crate::model::FooChoice> {
|
497 + | self.variant.as_ref()
|
498 + | }
|
669 499 | }
|
670 - | impl ComplexStruct {
|
500 + | impl RecursiveOperationInputOutputNested1 {
|
501 + | /// Creates a new builder-style object to manufacture [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
502 + | pub fn builder() -> crate::model::recursive_operation_input_output_nested1::Builder {
|
503 + | crate::model::recursive_operation_input_output_nested1::Builder::default()
|
504 + | }
|
505 + | }
|
506 + | impl crate::constrained::Constrained for crate::model::RecursiveOperationInputOutputNested1 {
|
507 + | type Unconstrained = crate::model::recursive_operation_input_output_nested1::Builder;
|
508 + | }
|
509 + |
|
510 + | #[allow(missing_docs)] // documentation missing in model
|
511 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
512 + | pub enum Events {
|
671 513 | #[allow(missing_docs)] // documentation missing in model
|
672 - | pub fn structure(&self) -> ::std::option::Option<&crate::model::SimpleStruct> {
|
673 - | self.structure.as_ref()
|
514 + | A(crate::model::Event),
|
515 + | #[allow(missing_docs)] // documentation missing in model
|
516 + | B(crate::model::Event),
|
517 + | #[allow(missing_docs)] // documentation missing in model
|
518 + | C(crate::model::Event),
|
519 + | }
|
520 + | impl Events {
|
521 + | /// Tries to convert the enum instance into [`A`](crate::model::Events::A), extracting the inner [`Event`](crate::model::Event).
|
522 + | /// Returns `Err(&Self)` if it can't be converted.
|
523 + | pub fn as_a(&self) -> ::std::result::Result<&crate::model::Event, &Self> {
|
524 + | if let Events::A(val) = &self {
|
525 + | ::std::result::Result::Ok(val)
|
526 + | } else {
|
527 + | ::std::result::Result::Err(self)
|
528 + | }
|
529 + | }
|
530 + | /// Returns true if this is a [`A`](crate::model::Events::A).
|
531 + | pub fn is_a(&self) -> bool {
|
532 + | self.as_a().is_ok()
|
533 + | }
|
534 + | /// Tries to convert the enum instance into [`B`](crate::model::Events::B), extracting the inner [`Event`](crate::model::Event).
|
535 + | /// Returns `Err(&Self)` if it can't be converted.
|
536 + | pub fn as_b(&self) -> ::std::result::Result<&crate::model::Event, &Self> {
|
537 + | if let Events::B(val) = &self {
|
538 + | ::std::result::Result::Ok(val)
|
539 + | } else {
|
540 + | ::std::result::Result::Err(self)
|
541 + | }
|
542 + | }
|
543 + | /// Returns true if this is a [`B`](crate::model::Events::B).
|
544 + | pub fn is_b(&self) -> bool {
|
545 + | self.as_b().is_ok()
|
546 + | }
|
547 + | /// Tries to convert the enum instance into [`C`](crate::model::Events::C), extracting the inner [`Event`](crate::model::Event).
|
548 + | /// Returns `Err(&Self)` if it can't be converted.
|
549 + | pub fn as_c(&self) -> ::std::result::Result<&crate::model::Event, &Self> {
|
550 + | if let Events::C(val) = &self {
|
551 + | ::std::result::Result::Ok(val)
|
552 + | } else {
|
553 + | ::std::result::Result::Err(self)
|
554 + | }
|
555 + | }
|
556 + | /// Returns true if this is a [`C`](crate::model::Events::C).
|
557 + | pub fn is_c(&self) -> bool {
|
558 + | self.as_c().is_ok()
|
559 + | }
|
560 + | }
|
561 + |
|
562 + | /// Describes one specific validation failure for an input member.
|
563 + | #[derive(
|
564 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
565 + | )]
|
566 + | pub struct ValidationExceptionField {
|
567 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
568 + | pub path: ::std::string::String,
|
569 + | /// A detailed description of the validation failure.
|
570 + | pub message: ::std::string::String,
|
571 + | }
|
572 + | impl ValidationExceptionField {
|
573 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
574 + | pub fn path(&self) -> &str {
|
575 + | use std::ops::Deref;
|
576 + | self.path.deref()
|
577 + | }
|
578 + | /// A detailed description of the validation failure.
|
579 + | pub fn message(&self) -> &str {
|
580 + | use std::ops::Deref;
|
581 + | self.message.deref()
|
582 + | }
|
583 + | }
|
584 + | impl ValidationExceptionField {
|
585 + | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
586 + | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
587 + | crate::model::validation_exception_field::Builder::default()
|
588 + | }
|
589 + | }
|
590 + |
|
591 + | #[allow(missing_docs)] // documentation missing in model
|
592 + | #[derive(
|
593 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
594 + | )]
|
595 + | pub struct Unit {}
|
596 + | impl Unit {
|
597 + | /// Creates a new builder-style object to manufacture [`Unit`](crate::model::Unit).
|
598 + | pub fn builder() -> crate::model::unit::Builder {
|
599 + | crate::model::unit::Builder::default()
|
600 + | }
|
601 + | }
|
602 + | impl crate::constrained::Constrained for crate::model::Unit {
|
603 + | type Unconstrained = crate::model::unit::Builder;
|
604 + | }
|
605 + |
|
606 + | #[allow(missing_docs)] // documentation missing in model
|
607 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
608 + | pub struct ComplexStruct {
|
609 + | #[allow(missing_docs)] // documentation missing in model
|
610 + | pub structure: ::std::option::Option<crate::model::SimpleStruct>,
|
611 + | #[allow(missing_docs)] // documentation missing in model
|
612 + | pub empty_structure: ::std::option::Option<crate::model::EmptyStruct>,
|
613 + | #[allow(missing_docs)] // documentation missing in model
|
614 + | pub list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
615 + | #[allow(missing_docs)] // documentation missing in model
|
616 + | pub map: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
|
617 + | #[allow(missing_docs)] // documentation missing in model
|
618 + | pub union: ::std::option::Option<crate::model::SimpleUnion>,
|
619 + | #[allow(missing_docs)] // documentation missing in model
|
620 + | pub unit_union: ::std::option::Option<crate::model::UnitUnion>,
|
621 + | #[allow(missing_docs)] // documentation missing in model
|
622 + | pub structure_list: ::std::option::Option<::std::vec::Vec<crate::model::SimpleStruct>>,
|
623 + | #[allow(missing_docs)] // documentation missing in model
|
624 + | pub complex_list: ::std::vec::Vec<
|
625 + | ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
626 + | >,
|
627 + | #[allow(missing_docs)] // documentation missing in model
|
628 + | pub complex_map: ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
629 + | #[allow(missing_docs)] // documentation missing in model
|
630 + | pub complex_union: ::std::boxed::Box<crate::model::ComplexUnion>,
|
631 + | }
|
632 + | impl ComplexStruct {
|
633 + | #[allow(missing_docs)] // documentation missing in model
|
634 + | pub fn structure(&self) -> ::std::option::Option<&crate::model::SimpleStruct> {
|
635 + | self.structure.as_ref()
|
636 + | }
|
637 + | #[allow(missing_docs)] // documentation missing in model
|
638 + | pub fn empty_structure(&self) -> ::std::option::Option<&crate::model::EmptyStruct> {
|
639 + | self.empty_structure.as_ref()
|
640 + | }
|
641 + | #[allow(missing_docs)] // documentation missing in model
|
642 + | pub fn list(&self) -> ::std::option::Option<&[::std::string::String]> {
|
643 + | self.list.as_deref()
|
644 + | }
|
645 + | #[allow(missing_docs)] // documentation missing in model
|
646 + | pub fn map(
|
647 + | &self,
|
648 + | ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> {
|
649 + | self.map.as_ref()
|
650 + | }
|
651 + | #[allow(missing_docs)] // documentation missing in model
|
652 + | pub fn union(&self) -> ::std::option::Option<&crate::model::SimpleUnion> {
|
653 + | self.union.as_ref()
|
654 + | }
|
655 + | #[allow(missing_docs)] // documentation missing in model
|
656 + | pub fn unit_union(&self) -> ::std::option::Option<&crate::model::UnitUnion> {
|
657 + | self.unit_union.as_ref()
|
658 + | }
|
659 + | #[allow(missing_docs)] // documentation missing in model
|
660 + | pub fn structure_list(&self) -> ::std::option::Option<&[crate::model::SimpleStruct]> {
|
661 + | self.structure_list.as_deref()
|
662 + | }
|
663 + | #[allow(missing_docs)] // documentation missing in model
|
664 + | pub fn complex_list(
|
665 + | &self,
|
666 + | ) -> &[::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>] {
|
667 + | use std::ops::Deref;
|
668 + | self.complex_list.deref()
|
669 + | }
|
670 + | #[allow(missing_docs)] // documentation missing in model
|
671 + | pub fn complex_map(
|
672 + | &self,
|
673 + | ) -> &::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion> {
|
674 + | &self.complex_map
|
675 + | }
|
676 + | #[allow(missing_docs)] // documentation missing in model
|
677 + | pub fn complex_union(&self) -> &crate::model::ComplexUnion {
|
678 + | use std::ops::Deref;
|
679 + | self.complex_union.deref()
|
680 + | }
|
681 + | }
|
682 + | impl ComplexStruct {
|
683 + | /// Creates a new builder-style object to manufacture [`ComplexStruct`](crate::model::ComplexStruct).
|
684 + | pub fn builder() -> crate::model::complex_struct::Builder {
|
685 + | crate::model::complex_struct::Builder::default()
|
686 + | }
|
687 + | }
|
688 + | impl crate::constrained::Constrained for crate::model::ComplexStruct {
|
689 + | type Unconstrained = crate::model::complex_struct::Builder;
|
690 + | }
|
691 + |
|
692 + | #[allow(missing_docs)] // documentation missing in model
|
693 + | #[derive(
|
694 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
695 + | )]
|
696 + | pub struct RecursiveOperationInputOutputNested2 {
|
697 + | #[allow(missing_docs)] // documentation missing in model
|
698 + | pub bar: ::std::option::Option<::std::string::String>,
|
699 + | #[allow(missing_docs)] // documentation missing in model
|
700 + | pub recursive_member: ::std::option::Option<crate::model::RecursiveOperationInputOutputNested1>,
|
701 + | }
|
702 + | impl RecursiveOperationInputOutputNested2 {
|
703 + | #[allow(missing_docs)] // documentation missing in model
|
704 + | pub fn bar(&self) -> ::std::option::Option<&str> {
|
705 + | self.bar.as_deref()
|
706 + | }
|
707 + | #[allow(missing_docs)] // documentation missing in model
|
708 + | pub fn recursive_member(
|
709 + | &self,
|
710 + | ) -> ::std::option::Option<&crate::model::RecursiveOperationInputOutputNested1> {
|
711 + | self.recursive_member.as_ref()
|
712 + | }
|
713 + | }
|
714 + | impl RecursiveOperationInputOutputNested2 {
|
715 + | /// Creates a new builder-style object to manufacture [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
716 + | pub fn builder() -> crate::model::recursive_operation_input_output_nested2::Builder {
|
717 + | crate::model::recursive_operation_input_output_nested2::Builder::default()
|
718 + | }
|
719 + | }
|
720 + | impl crate::constrained::Constrained for crate::model::RecursiveOperationInputOutputNested2 {
|
721 + | type Unconstrained = crate::model::recursive_operation_input_output_nested2::Builder;
|
722 + | }
|
723 + |
|
724 + | #[allow(missing_docs)] // documentation missing in model
|
725 + | #[derive(
|
726 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
727 + | )]
|
728 + | pub enum FooChoice {
|
729 + | #[allow(missing_docs)] // documentation missing in model
|
730 + | Choice1(::std::string::String),
|
731 + | #[allow(missing_docs)] // documentation missing in model
|
732 + | Choice2(::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested1>),
|
733 + | }
|
734 + | impl FooChoice {
|
735 + | /// Tries to convert the enum instance into [`Choice1`](crate::model::FooChoice::Choice1), extracting the inner [`String`](::std::string::String).
|
736 + | /// Returns `Err(&Self)` if it can't be converted.
|
737 + | pub fn as_choice1(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
738 + | if let FooChoice::Choice1(val) = &self {
|
739 + | ::std::result::Result::Ok(val)
|
740 + | } else {
|
741 + | ::std::result::Result::Err(self)
|
742 + | }
|
743 + | }
|
744 + | /// Returns true if this is a [`Choice1`](crate::model::FooChoice::Choice1).
|
745 + | pub fn is_choice1(&self) -> bool {
|
746 + | self.as_choice1().is_ok()
|
747 + | }
|
748 + | /// Tries to convert the enum instance into [`Choice2`](crate::model::FooChoice::Choice2), extracting the inner [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
749 + | /// Returns `Err(&Self)` if it can't be converted.
|
750 + | pub fn as_choice2(
|
751 + | &self,
|
752 + | ) -> ::std::result::Result<
|
753 + | &::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested1>,
|
754 + | &Self,
|
755 + | > {
|
756 + | if let FooChoice::Choice2(val) = &self {
|
757 + | ::std::result::Result::Ok(val)
|
758 + | } else {
|
759 + | ::std::result::Result::Err(self)
|
760 + | }
|
761 + | }
|
762 + | /// Returns true if this is a [`Choice2`](crate::model::FooChoice::Choice2).
|
763 + | pub fn is_choice2(&self) -> bool {
|
764 + | self.as_choice2().is_ok()
|
765 + | }
|
766 + | }
|
767 + |
|
768 + | #[allow(missing_docs)] // documentation missing in model
|
769 + | #[derive(
|
770 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
771 + | )]
|
772 + | pub struct Event {}
|
773 + | impl Event {
|
774 + | /// Creates a new builder-style object to manufacture [`Event`](crate::model::Event).
|
775 + | pub fn builder() -> crate::model::event::Builder {
|
776 + | crate::model::event::Builder::default()
|
777 + | }
|
778 + | }
|
779 + | impl crate::constrained::Constrained for crate::model::Event {
|
780 + | type Unconstrained = crate::model::event::Builder;
|
781 + | }
|
782 + | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
783 + | pub mod simple_struct {
|
784 + |
|
785 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
786 + | /// Holds one variant for each of the ways the builder can fail.
|
787 + | #[non_exhaustive]
|
788 + | #[allow(clippy::enum_variant_names)]
|
789 + | pub enum ConstraintViolation {
|
790 + | /// Constraint violation occurred building member `r#enum` when building `SimpleStruct`.
|
791 + | #[doc(hidden)]
|
792 + | Enum(crate::model::suit::ConstraintViolation),
|
793 + | /// `required_blob` was not provided but it is required when building `SimpleStruct`.
|
794 + | MissingRequiredBlob,
|
795 + | /// `required_boolean` was not provided but it is required when building `SimpleStruct`.
|
796 + | MissingRequiredBoolean,
|
797 + | /// `required_string` was not provided but it is required when building `SimpleStruct`.
|
798 + | MissingRequiredString,
|
799 + | /// `required_byte` was not provided but it is required when building `SimpleStruct`.
|
800 + | MissingRequiredByte,
|
801 + | /// `required_short` was not provided but it is required when building `SimpleStruct`.
|
802 + | MissingRequiredShort,
|
803 + | /// `required_integer` was not provided but it is required when building `SimpleStruct`.
|
804 + | MissingRequiredInteger,
|
805 + | /// `required_long` was not provided but it is required when building `SimpleStruct`.
|
806 + | MissingRequiredLong,
|
807 + | /// `required_float` was not provided but it is required when building `SimpleStruct`.
|
808 + | MissingRequiredFloat,
|
809 + | /// `required_double` was not provided but it is required when building `SimpleStruct`.
|
810 + | MissingRequiredDouble,
|
811 + | /// `required_timestamp` was not provided but it is required when building `SimpleStruct`.
|
812 + | MissingRequiredTimestamp,
|
813 + | /// `required_enum` was not provided but it is required when building `SimpleStruct`.
|
814 + | MissingRequiredEnum,
|
815 + | /// Constraint violation occurred building member `required_enum` when building `SimpleStruct`.
|
816 + | #[doc(hidden)]
|
817 + | RequiredEnum(crate::model::suit::ConstraintViolation),
|
818 + | }
|
819 + | impl ::std::fmt::Display for ConstraintViolation {
|
820 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
821 + | match self {
|
822 + | ConstraintViolation::Enum(_) => write!(f, "constraint violation occurred building member `r#enum` when building `SimpleStruct`"),
|
823 + | ConstraintViolation::MissingRequiredBlob => write!(f, "`required_blob` was not provided but it is required when building `SimpleStruct`"),
|
824 + | ConstraintViolation::MissingRequiredBoolean => write!(f, "`required_boolean` was not provided but it is required when building `SimpleStruct`"),
|
825 + | ConstraintViolation::MissingRequiredString => write!(f, "`required_string` was not provided but it is required when building `SimpleStruct`"),
|
826 + | ConstraintViolation::MissingRequiredByte => write!(f, "`required_byte` was not provided but it is required when building `SimpleStruct`"),
|
827 + | ConstraintViolation::MissingRequiredShort => write!(f, "`required_short` was not provided but it is required when building `SimpleStruct`"),
|
828 + | ConstraintViolation::MissingRequiredInteger => write!(f, "`required_integer` was not provided but it is required when building `SimpleStruct`"),
|
829 + | ConstraintViolation::MissingRequiredLong => write!(f, "`required_long` was not provided but it is required when building `SimpleStruct`"),
|
830 + | ConstraintViolation::MissingRequiredFloat => write!(f, "`required_float` was not provided but it is required when building `SimpleStruct`"),
|
831 + | ConstraintViolation::MissingRequiredDouble => write!(f, "`required_double` was not provided but it is required when building `SimpleStruct`"),
|
832 + | ConstraintViolation::MissingRequiredTimestamp => write!(f, "`required_timestamp` was not provided but it is required when building `SimpleStruct`"),
|
833 + | ConstraintViolation::MissingRequiredEnum => write!(f, "`required_enum` was not provided but it is required when building `SimpleStruct`"),
|
834 + | ConstraintViolation::RequiredEnum(_) => write!(f, "constraint violation occurred building member `required_enum` when building `SimpleStruct`"),
|
835 + | }
|
836 + | }
|
837 + | }
|
838 + | impl ::std::error::Error for ConstraintViolation {}
|
839 + | impl ConstraintViolation {
|
840 + | pub(crate) fn as_validation_exception_field(
|
841 + | self,
|
842 + | path: ::std::string::String,
|
843 + | ) -> crate::model::ValidationExceptionField {
|
844 + | match self {
|
845 + | ConstraintViolation::Enum(inner) => inner.as_validation_exception_field(path + "/enum"),
|
846 + | ConstraintViolation::MissingRequiredBlob => crate::model::ValidationExceptionField {
|
847 + | message: format!("Value at '{}/requiredBlob' failed to satisfy constraint: Member must not be null", path),
|
848 + | path: path + "/requiredBlob",
|
849 + | },
|
850 + | ConstraintViolation::MissingRequiredBoolean => crate::model::ValidationExceptionField {
|
851 + | message: format!("Value at '{}/requiredBoolean' failed to satisfy constraint: Member must not be null", path),
|
852 + | path: path + "/requiredBoolean",
|
853 + | },
|
854 + | ConstraintViolation::MissingRequiredString => crate::model::ValidationExceptionField {
|
855 + | message: format!("Value at '{}/requiredString' failed to satisfy constraint: Member must not be null", path),
|
856 + | path: path + "/requiredString",
|
857 + | },
|
858 + | ConstraintViolation::MissingRequiredByte => crate::model::ValidationExceptionField {
|
859 + | message: format!("Value at '{}/requiredByte' failed to satisfy constraint: Member must not be null", path),
|
860 + | path: path + "/requiredByte",
|
861 + | },
|
862 + | ConstraintViolation::MissingRequiredShort => crate::model::ValidationExceptionField {
|
863 + | message: format!("Value at '{}/requiredShort' failed to satisfy constraint: Member must not be null", path),
|
864 + | path: path + "/requiredShort",
|
865 + | },
|
866 + | ConstraintViolation::MissingRequiredInteger => crate::model::ValidationExceptionField {
|
867 + | message: format!("Value at '{}/requiredInteger' failed to satisfy constraint: Member must not be null", path),
|
868 + | path: path + "/requiredInteger",
|
869 + | },
|
870 + | ConstraintViolation::MissingRequiredLong => crate::model::ValidationExceptionField {
|
871 + | message: format!("Value at '{}/requiredLong' failed to satisfy constraint: Member must not be null", path),
|
872 + | path: path + "/requiredLong",
|
873 + | },
|
874 + | ConstraintViolation::MissingRequiredFloat => crate::model::ValidationExceptionField {
|
875 + | message: format!("Value at '{}/requiredFloat' failed to satisfy constraint: Member must not be null", path),
|
876 + | path: path + "/requiredFloat",
|
877 + | },
|
878 + | ConstraintViolation::MissingRequiredDouble => crate::model::ValidationExceptionField {
|
879 + | message: format!("Value at '{}/requiredDouble' failed to satisfy constraint: Member must not be null", path),
|
880 + | path: path + "/requiredDouble",
|
881 + | },
|
882 + | ConstraintViolation::MissingRequiredTimestamp => crate::model::ValidationExceptionField {
|
883 + | message: format!("Value at '{}/requiredTimestamp' failed to satisfy constraint: Member must not be null", path),
|
884 + | path: path + "/requiredTimestamp",
|
885 + | },
|
886 + | ConstraintViolation::MissingRequiredEnum => crate::model::ValidationExceptionField {
|
887 + | message: format!("Value at '{}/requiredEnum' failed to satisfy constraint: Member must not be null", path),
|
888 + | path: path + "/requiredEnum",
|
889 + | },
|
890 + | ConstraintViolation::RequiredEnum(inner) => inner.as_validation_exception_field(path + "/requiredEnum"),
|
891 + | }
|
892 + | }
|
893 + | }
|
894 + | impl ::std::convert::From<Builder>
|
895 + | for crate::constrained::MaybeConstrained<crate::model::SimpleStruct>
|
896 + | {
|
897 + | fn from(builder: Builder) -> Self {
|
898 + | Self::Unconstrained(builder)
|
899 + | }
|
900 + | }
|
901 + | impl ::std::convert::TryFrom<Builder> for crate::model::SimpleStruct {
|
902 + | type Error = ConstraintViolation;
|
903 + |
|
904 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
905 + | builder.build()
|
906 + | }
|
907 + | }
|
908 + | /// A builder for [`SimpleStruct`](crate::model::SimpleStruct).
|
909 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
910 + | pub struct Builder {
|
911 + | pub(crate) blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
912 + | pub(crate) boolean: ::std::option::Option<bool>,
|
913 + | pub(crate) string: ::std::option::Option<::std::string::String>,
|
914 + | pub(crate) byte: ::std::option::Option<i8>,
|
915 + | pub(crate) short: ::std::option::Option<i16>,
|
916 + | pub(crate) integer: ::std::option::Option<i32>,
|
917 + | pub(crate) long: ::std::option::Option<i64>,
|
918 + | pub(crate) float: ::std::option::Option<f32>,
|
919 + | pub(crate) double: ::std::option::Option<f64>,
|
920 + | pub(crate) timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
|
921 + | pub(crate) r#enum:
|
922 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
923 + | pub(crate) required_blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
924 + | pub(crate) required_boolean: ::std::option::Option<bool>,
|
925 + | pub(crate) required_string: ::std::option::Option<::std::string::String>,
|
926 + | pub(crate) required_byte: ::std::option::Option<i8>,
|
927 + | pub(crate) required_short: ::std::option::Option<i16>,
|
928 + | pub(crate) required_integer: ::std::option::Option<i32>,
|
929 + | pub(crate) required_long: ::std::option::Option<i64>,
|
930 + | pub(crate) required_float: ::std::option::Option<f32>,
|
931 + | pub(crate) required_double: ::std::option::Option<f64>,
|
932 + | pub(crate) required_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
|
933 + | pub(crate) required_enum:
|
934 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
935 + | }
|
936 + | impl Builder {
|
937 + | #[allow(missing_docs)] // documentation missing in model
|
938 + | pub fn blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
|
939 + | self.blob = input;
|
940 + | self
|
941 + | }
|
942 + | #[allow(missing_docs)] // documentation missing in model
|
943 + | pub(crate) fn set_blob(
|
944 + | mut self,
|
945 + | input: Option<impl ::std::convert::Into<::aws_smithy_types::Blob>>,
|
946 + | ) -> Self {
|
947 + | self.blob = input.map(|v| v.into());
|
948 + | self
|
949 + | }
|
950 + | #[allow(missing_docs)] // documentation missing in model
|
951 + | pub fn boolean(mut self, input: ::std::option::Option<bool>) -> Self {
|
952 + | self.boolean = input;
|
953 + | self
|
954 + | }
|
955 + | #[allow(missing_docs)] // documentation missing in model
|
956 + | pub(crate) fn set_boolean(
|
957 + | mut self,
|
958 + | input: Option<impl ::std::convert::Into<bool>>,
|
959 + | ) -> Self {
|
960 + | self.boolean = input.map(|v| v.into());
|
961 + | self
|
962 + | }
|
963 + | #[allow(missing_docs)] // documentation missing in model
|
964 + | pub fn string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
965 + | self.string = input;
|
966 + | self
|
967 + | }
|
968 + | #[allow(missing_docs)] // documentation missing in model
|
969 + | pub(crate) fn set_string(
|
970 + | mut self,
|
971 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
972 + | ) -> Self {
|
973 + | self.string = input.map(|v| v.into());
|
974 + | self
|
975 + | }
|
976 + | #[allow(missing_docs)] // documentation missing in model
|
977 + | pub fn byte(mut self, input: ::std::option::Option<i8>) -> Self {
|
978 + | self.byte = input;
|
979 + | self
|
980 + | }
|
981 + | #[allow(missing_docs)] // documentation missing in model
|
982 + | pub(crate) fn set_byte(mut self, input: Option<impl ::std::convert::Into<i8>>) -> Self {
|
983 + | self.byte = input.map(|v| v.into());
|
984 + | self
|
674 985 | }
|
675 986 | #[allow(missing_docs)] // documentation missing in model
|
676 - | pub fn empty_structure(&self) -> ::std::option::Option<&crate::model::EmptyStruct> {
|
677 - | self.empty_structure.as_ref()
|
987 + | pub fn short(mut self, input: ::std::option::Option<i16>) -> Self {
|
988 + | self.short = input;
|
989 + | self
|
678 990 | }
|
679 991 | #[allow(missing_docs)] // documentation missing in model
|
680 - | pub fn list(&self) -> ::std::option::Option<&[::std::string::String]> {
|
681 - | self.list.as_deref()
|
992 + | pub(crate) fn set_short(mut self, input: Option<impl ::std::convert::Into<i16>>) -> Self {
|
993 + | self.short = input.map(|v| v.into());
|
994 + | self
|
682 995 | }
|
683 996 | #[allow(missing_docs)] // documentation missing in model
|
684 - | pub fn map(
|
685 - | &self,
|
686 - | ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> {
|
687 - | self.map.as_ref()
|
997 + | pub fn integer(mut self, input: ::std::option::Option<i32>) -> Self {
|
998 + | self.integer = input;
|
999 + | self
|
688 1000 | }
|
689 1001 | #[allow(missing_docs)] // documentation missing in model
|
690 - | pub fn union(&self) -> ::std::option::Option<&crate::model::SimpleUnion> {
|
691 - | self.union.as_ref()
|
1002 + | pub(crate) fn set_integer(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
|
1003 + | self.integer = input.map(|v| v.into());
|
1004 + | self
|
692 1005 | }
|
693 1006 | #[allow(missing_docs)] // documentation missing in model
|
694 - | pub fn unit_union(&self) -> ::std::option::Option<&crate::model::UnitUnion> {
|
695 - | self.unit_union.as_ref()
|
1007 + | pub fn long(mut self, input: ::std::option::Option<i64>) -> Self {
|
1008 + | self.long = input;
|
1009 + | self
|
696 1010 | }
|
697 1011 | #[allow(missing_docs)] // documentation missing in model
|
698 - | pub fn structure_list(&self) -> ::std::option::Option<&[crate::model::SimpleStruct]> {
|
699 - | self.structure_list.as_deref()
|
1012 + | pub(crate) fn set_long(mut self, input: Option<impl ::std::convert::Into<i64>>) -> Self {
|
1013 + | self.long = input.map(|v| v.into());
|
1014 + | self
|
700 1015 | }
|
701 1016 | #[allow(missing_docs)] // documentation missing in model
|
702 - | pub fn complex_list(
|
703 - | &self,
|
704 - | ) -> &[::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>] {
|
705 - | use std::ops::Deref;
|
706 - | self.complex_list.deref()
|
1017 + | pub fn float(mut self, input: ::std::option::Option<f32>) -> Self {
|
1018 + | self.float = input;
|
1019 + | self
|
707 1020 | }
|
708 1021 | #[allow(missing_docs)] // documentation missing in model
|
709 - | pub fn complex_map(
|
710 - | &self,
|
711 - | ) -> &::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion> {
|
712 - | &self.complex_map
|
1022 + | pub(crate) fn set_float(mut self, input: Option<impl ::std::convert::Into<f32>>) -> Self {
|
1023 + | self.float = input.map(|v| v.into());
|
1024 + | self
|
713 1025 | }
|
714 1026 | #[allow(missing_docs)] // documentation missing in model
|
715 - | pub fn complex_union(&self) -> &crate::model::ComplexUnion {
|
716 - | use std::ops::Deref;
|
717 - | self.complex_union.deref()
|
718 - | }
|
719 - | }
|
720 - | impl ComplexStruct {
|
721 - | /// Creates a new builder-style object to manufacture [`ComplexStruct`](crate::model::ComplexStruct).
|
722 - | pub fn builder() -> crate::model::complex_struct::Builder {
|
723 - | crate::model::complex_struct::Builder::default()
|
1027 + | pub fn double(mut self, input: ::std::option::Option<f64>) -> Self {
|
1028 + | self.double = input;
|
1029 + | self
|
724 1030 | }
|
725 - | }
|
726 - | impl crate::constrained::Constrained for crate::model::ComplexStruct {
|
727 - | type Unconstrained = crate::model::complex_struct::Builder;
|
728 - | }
|
729 - |
|
730 - | #[allow(missing_docs)] // documentation missing in model
|
731 - | #[derive(
|
732 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
733 - | )]
|
734 - | pub enum UnitUnion {
|
735 - | #[allow(missing_docs)] // documentation missing in model
|
736 - | UnitA,
|
737 1031 | #[allow(missing_docs)] // documentation missing in model
|
738 - | UnitB,
|
739 - | }
|
740 - | impl UnitUnion {
|
741 - | /// Tries to convert the enum instance into [`UnitA`](crate::model::UnitUnion::UnitA), extracting the inner `()`.
|
742 - | /// Returns `Err(&Self)` if it can't be converted.
|
743 - | pub fn as_unit_a(&self) -> ::std::result::Result<(), &Self> {
|
744 - | if let UnitUnion::UnitA = &self {
|
745 - | ::std::result::Result::Ok(())
|
746 - | } else {
|
747 - | ::std::result::Result::Err(self)
|
748 - | }
|
749 - | }
|
750 - | /// Returns true if this is a [`UnitA`](crate::model::UnitUnion::UnitA).
|
751 - | pub fn is_unit_a(&self) -> bool {
|
752 - | self.as_unit_a().is_ok()
|
753 - | }
|
754 - | /// Tries to convert the enum instance into [`UnitB`](crate::model::UnitUnion::UnitB), extracting the inner `()`.
|
755 - | /// Returns `Err(&Self)` if it can't be converted.
|
756 - | pub fn as_unit_b(&self) -> ::std::result::Result<(), &Self> {
|
757 - | if let UnitUnion::UnitB = &self {
|
758 - | ::std::result::Result::Ok(())
|
759 - | } else {
|
760 - | ::std::result::Result::Err(self)
|
761 - | }
|
762 - | }
|
763 - | /// Returns true if this is a [`UnitB`](crate::model::UnitUnion::UnitB).
|
764 - | pub fn is_unit_b(&self) -> bool {
|
765 - | self.as_unit_b().is_ok()
|
766 - | }
|
767 - | }
|
768 - |
|
769 - | #[allow(missing_docs)] // documentation missing in model
|
770 - | #[derive(
|
771 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
772 - | )]
|
773 - | pub struct EmptyStruct {}
|
774 - | impl EmptyStruct {
|
775 - | /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::model::EmptyStruct).
|
776 - | pub fn builder() -> crate::model::empty_struct::Builder {
|
777 - | crate::model::empty_struct::Builder::default()
|
1032 + | pub(crate) fn set_double(mut self, input: Option<impl ::std::convert::Into<f64>>) -> Self {
|
1033 + | self.double = input.map(|v| v.into());
|
1034 + | self
|
778 1035 | }
|
779 - | }
|
780 - | impl crate::constrained::Constrained for crate::model::EmptyStruct {
|
781 - | type Unconstrained = crate::model::empty_struct::Builder;
|
782 - | }
|
783 - | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
784 - | pub mod validation_exception_field {
|
785 - |
|
786 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
787 - | /// Holds one variant for each of the ways the builder can fail.
|
788 - | #[non_exhaustive]
|
789 - | #[allow(clippy::enum_variant_names)]
|
790 - | pub enum ConstraintViolation {
|
791 - | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
792 - | MissingPath,
|
793 - | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
794 - | MissingMessage,
|
1036 + | #[allow(missing_docs)] // documentation missing in model
|
1037 + | pub fn timestamp(
|
1038 + | mut self,
|
1039 + | input: ::std::option::Option<::aws_smithy_types::DateTime>,
|
1040 + | ) -> Self {
|
1041 + | self.timestamp = input;
|
1042 + | self
|
795 1043 | }
|
796 - | impl ::std::fmt::Display for ConstraintViolation {
|
797 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
798 - | match self {
|
799 - | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
800 - | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
1044 + | #[allow(missing_docs)] // documentation missing in model
|
1045 + | pub(crate) fn set_timestamp(
|
1046 + | mut self,
|
1047 + | input: Option<impl ::std::convert::Into<::aws_smithy_types::DateTime>>,
|
1048 + | ) -> Self {
|
1049 + | self.timestamp = input.map(|v| v.into());
|
1050 + | self
|
801 1051 | }
|
1052 + | #[allow(missing_docs)] // documentation missing in model
|
1053 + | pub fn r#enum(mut self, input: ::std::option::Option<crate::model::Suit>) -> Self {
|
1054 + | self.r#enum = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1055 + | self
|
802 1056 | }
|
1057 + | #[allow(missing_docs)] // documentation missing in model
|
1058 + | pub(crate) fn set_enum(
|
1059 + | mut self,
|
1060 + | input: Option<
|
1061 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
1062 + | >,
|
1063 + | ) -> Self {
|
1064 + | self.r#enum = input.map(|v| v.into());
|
1065 + | self
|
803 1066 | }
|
804 - | impl ::std::error::Error for ConstraintViolation {}
|
805 - | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
806 - | type Error = ConstraintViolation;
|
807 - |
|
808 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
809 - | builder.build()
|
1067 + | #[allow(missing_docs)] // documentation missing in model
|
1068 + | pub fn required_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
|
1069 + | self.required_blob = Some(input);
|
1070 + | self
|
810 1071 | }
|
1072 + | #[allow(missing_docs)] // documentation missing in model
|
1073 + | pub(crate) fn set_required_blob(
|
1074 + | mut self,
|
1075 + | input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
|
1076 + | ) -> Self {
|
1077 + | self.required_blob = Some(input.into());
|
1078 + | self
|
811 1079 | }
|
812 - | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
813 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
814 - | pub struct Builder {
|
815 - | pub(crate) path: ::std::option::Option<::std::string::String>,
|
816 - | pub(crate) message: ::std::option::Option<::std::string::String>,
|
1080 + | #[allow(missing_docs)] // documentation missing in model
|
1081 + | pub fn required_boolean(mut self, input: bool) -> Self {
|
1082 + | self.required_boolean = Some(input);
|
1083 + | self
|
817 1084 | }
|
818 - | impl Builder {
|
819 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
820 - | pub fn path(mut self, input: ::std::string::String) -> Self {
|
821 - | self.path = Some(input);
|
1085 + | #[allow(missing_docs)] // documentation missing in model
|
1086 + | pub(crate) fn set_required_boolean(
|
1087 + | mut self,
|
1088 + | input: impl ::std::convert::Into<bool>,
|
1089 + | ) -> Self {
|
1090 + | self.required_boolean = Some(input.into());
|
822 1091 | self
|
823 1092 | }
|
824 - | /// A detailed description of the validation failure.
|
825 - | pub fn message(mut self, input: ::std::string::String) -> Self {
|
826 - | self.message = Some(input);
|
1093 + | #[allow(missing_docs)] // documentation missing in model
|
1094 + | pub fn required_string(mut self, input: ::std::string::String) -> Self {
|
1095 + | self.required_string = Some(input);
|
827 1096 | self
|
828 1097 | }
|
829 - | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
830 - | ///
|
831 - | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
832 - | ///
|
833 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
834 - | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
835 - | self.build_enforcing_all_constraints()
|
1098 + | #[allow(missing_docs)] // documentation missing in model
|
1099 + | pub(crate) fn set_required_string(
|
1100 + | mut self,
|
1101 + | input: impl ::std::convert::Into<::std::string::String>,
|
1102 + | ) -> Self {
|
1103 + | self.required_string = Some(input.into());
|
1104 + | self
|
836 1105 | }
|
837 - | fn build_enforcing_all_constraints(
|
838 - | self,
|
839 - | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
840 - | Ok(crate::model::ValidationExceptionField {
|
841 - | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
842 - | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
843 - | })
|
1106 + | #[allow(missing_docs)] // documentation missing in model
|
1107 + | pub fn required_byte(mut self, input: i8) -> Self {
|
1108 + | self.required_byte = Some(input);
|
1109 + | self
|
844 1110 | }
|
1111 + | #[allow(missing_docs)] // documentation missing in model
|
1112 + | pub(crate) fn set_required_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
|
1113 + | self.required_byte = Some(input.into());
|
1114 + | self
|
845 1115 | }
|
846 - | }
|
847 - | /// See [`Event`](crate::model::Event).
|
848 - | pub mod event {
|
849 - |
|
850 - | impl ::std::convert::From<Builder> for crate::model::Event {
|
851 - | fn from(builder: Builder) -> Self {
|
852 - | builder.build()
|
1116 + | #[allow(missing_docs)] // documentation missing in model
|
1117 + | pub fn required_short(mut self, input: i16) -> Self {
|
1118 + | self.required_short = Some(input);
|
1119 + | self
|
853 1120 | }
|
1121 + | #[allow(missing_docs)] // documentation missing in model
|
1122 + | pub(crate) fn set_required_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
|
1123 + | self.required_short = Some(input.into());
|
1124 + | self
|
854 1125 | }
|
855 - | /// A builder for [`Event`](crate::model::Event).
|
856 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
857 - | pub struct Builder {}
|
858 - | impl Builder {
|
859 - | /// Consumes the builder and constructs a [`Event`](crate::model::Event).
|
860 - | pub fn build(self) -> crate::model::Event {
|
861 - | self.build_enforcing_all_constraints()
|
1126 + | #[allow(missing_docs)] // documentation missing in model
|
1127 + | pub fn required_integer(mut self, input: i32) -> Self {
|
1128 + | self.required_integer = Some(input);
|
1129 + | self
|
862 1130 | }
|
863 - | fn build_enforcing_all_constraints(self) -> crate::model::Event {
|
864 - | crate::model::Event {}
|
1131 + | #[allow(missing_docs)] // documentation missing in model
|
1132 + | pub(crate) fn set_required_integer(
|
1133 + | mut self,
|
1134 + | input: impl ::std::convert::Into<i32>,
|
1135 + | ) -> Self {
|
1136 + | self.required_integer = Some(input.into());
|
1137 + | self
|
865 1138 | }
|
1139 + | #[allow(missing_docs)] // documentation missing in model
|
1140 + | pub fn required_long(mut self, input: i64) -> Self {
|
1141 + | self.required_long = Some(input);
|
1142 + | self
|
866 1143 | }
|
867 - | }
|
868 - | /// See [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
869 - | pub mod recursive_operation_input_output_nested1 {
|
870 - |
|
871 - | impl ::std::convert::From<Builder> for crate::model::RecursiveOperationInputOutputNested1 {
|
872 - | fn from(builder: Builder) -> Self {
|
873 - | builder.build()
|
1144 + | #[allow(missing_docs)] // documentation missing in model
|
1145 + | pub(crate) fn set_required_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
|
1146 + | self.required_long = Some(input.into());
|
1147 + | self
|
874 1148 | }
|
1149 + | #[allow(missing_docs)] // documentation missing in model
|
1150 + | pub fn required_float(mut self, input: f32) -> Self {
|
1151 + | self.required_float = Some(input);
|
1152 + | self
|
875 1153 | }
|
876 - | /// A builder for [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
877 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
878 - | pub struct Builder {
|
879 - | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
880 - | pub(crate) nested: ::std::option::Option<
|
881 - | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
882 - | >,
|
883 - | pub(crate) variant: ::std::option::Option<crate::model::FooChoice>,
|
1154 + | #[allow(missing_docs)] // documentation missing in model
|
1155 + | pub(crate) fn set_required_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
|
1156 + | self.required_float = Some(input.into());
|
1157 + | self
|
884 1158 | }
|
885 - | impl Builder {
|
886 1159 | #[allow(missing_docs)] // documentation missing in model
|
887 - | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
888 - | self.foo = input;
|
1160 + | pub fn required_double(mut self, input: f64) -> Self {
|
1161 + | self.required_double = Some(input);
|
889 1162 | self
|
890 1163 | }
|
891 1164 | #[allow(missing_docs)] // documentation missing in model
|
892 - | pub(crate) fn set_foo(
|
893 - | mut self,
|
894 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
895 - | ) -> Self {
|
896 - | self.foo = input.map(|v| v.into());
|
1165 + | pub(crate) fn set_required_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
|
1166 + | self.required_double = Some(input.into());
|
897 1167 | self
|
898 1168 | }
|
899 1169 | #[allow(missing_docs)] // documentation missing in model
|
900 - | pub fn nested(
|
901 - | mut self,
|
902 - | input: ::std::option::Option<
|
903 - | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
904 - | >,
|
905 - | ) -> Self {
|
906 - | self.nested = input;
|
1170 + | pub fn required_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
|
1171 + | self.required_timestamp = Some(input);
|
907 1172 | self
|
908 1173 | }
|
909 1174 | #[allow(missing_docs)] // documentation missing in model
|
910 - | pub(crate) fn set_nested(
|
1175 + | pub(crate) fn set_required_timestamp(
|
911 1176 | mut self,
|
912 - | input: Option<
|
913 - | impl ::std::convert::Into<
|
914 - | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
915 - | >,
|
916 - | >,
|
1177 + | input: impl ::std::convert::Into<::aws_smithy_types::DateTime>,
|
917 1178 | ) -> Self {
|
918 - | self.nested = input.map(|v| v.into());
|
1179 + | self.required_timestamp = Some(input.into());
|
919 1180 | self
|
920 1181 | }
|
921 1182 | #[allow(missing_docs)] // documentation missing in model
|
922 - | pub fn variant(mut self, input: ::std::option::Option<crate::model::FooChoice>) -> Self {
|
923 - | self.variant = input;
|
1183 + | pub fn required_enum(mut self, input: crate::model::Suit) -> Self {
|
1184 + | self.required_enum = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
924 1185 | self
|
925 1186 | }
|
926 1187 | #[allow(missing_docs)] // documentation missing in model
|
927 - | pub(crate) fn set_variant(
|
1188 + | pub(crate) fn set_required_enum(
|
928 1189 | mut self,
|
929 - | input: Option<impl ::std::convert::Into<crate::model::FooChoice>>,
|
1190 + | input: impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
930 1191 | ) -> Self {
|
931 - | self.variant = input.map(|v| v.into());
|
1192 + | self.required_enum = Some(input.into());
|
932 1193 | self
|
933 1194 | }
|
934 - | /// Consumes the builder and constructs a [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
935 - | pub fn build(self) -> crate::model::RecursiveOperationInputOutputNested1 {
|
1195 + | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
1196 + | ///
|
1197 + | /// The builder fails to construct a [`SimpleStruct`](crate::model::SimpleStruct) if a [`ConstraintViolation`] occurs.
|
1198 + | ///
|
1199 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1200 + | pub fn build(self) -> Result<crate::model::SimpleStruct, ConstraintViolation> {
|
936 1201 | self.build_enforcing_all_constraints()
|
937 1202 | }
|
938 1203 | fn build_enforcing_all_constraints(
|
939 1204 | self,
|
940 - | ) -> crate::model::RecursiveOperationInputOutputNested1 {
|
941 - | crate::model::RecursiveOperationInputOutputNested1 {
|
942 - | foo: self.foo,
|
943 - | nested: self.nested,
|
944 - | variant: self.variant,
|
945 - | }
|
1205 + | ) -> Result<crate::model::SimpleStruct, ConstraintViolation> {
|
1206 + | Ok(crate::model::SimpleStruct {
|
1207 + | blob: self.blob,
|
1208 + | boolean: self.boolean,
|
1209 + | string: self.string,
|
1210 + | byte: self.byte,
|
1211 + | short: self.short,
|
1212 + | integer: self.integer,
|
1213 + | long: self.long,
|
1214 + | float: self.float,
|
1215 + | double: self.double,
|
1216 + | timestamp: self.timestamp,
|
1217 + | r#enum: self
|
1218 + | .r#enum
|
1219 + | .map(|v| match v {
|
1220 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1221 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1222 + | })
|
1223 + | .map(|res| res.map_err(ConstraintViolation::Enum))
|
1224 + | .transpose()?,
|
1225 + | required_blob: self
|
1226 + | .required_blob
|
1227 + | .ok_or(ConstraintViolation::MissingRequiredBlob)?,
|
1228 + | required_boolean: self
|
1229 + | .required_boolean
|
1230 + | .ok_or(ConstraintViolation::MissingRequiredBoolean)?,
|
1231 + | required_string: self
|
1232 + | .required_string
|
1233 + | .ok_or(ConstraintViolation::MissingRequiredString)?,
|
1234 + | required_byte: self
|
1235 + | .required_byte
|
1236 + | .ok_or(ConstraintViolation::MissingRequiredByte)?,
|
1237 + | required_short: self
|
1238 + | .required_short
|
1239 + | .ok_or(ConstraintViolation::MissingRequiredShort)?,
|
1240 + | required_integer: self
|
1241 + | .required_integer
|
1242 + | .ok_or(ConstraintViolation::MissingRequiredInteger)?,
|
1243 + | required_long: self
|
1244 + | .required_long
|
1245 + | .ok_or(ConstraintViolation::MissingRequiredLong)?,
|
1246 + | required_float: self
|
1247 + | .required_float
|
1248 + | .ok_or(ConstraintViolation::MissingRequiredFloat)?,
|
1249 + | required_double: self
|
1250 + | .required_double
|
1251 + | .ok_or(ConstraintViolation::MissingRequiredDouble)?,
|
1252 + | required_timestamp: self
|
1253 + | .required_timestamp
|
1254 + | .ok_or(ConstraintViolation::MissingRequiredTimestamp)?,
|
1255 + | required_enum: self
|
1256 + | .required_enum
|
1257 + | .map(|v| match v {
|
1258 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1259 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1260 + | })
|
1261 + | .map(|res| res.map_err(ConstraintViolation::RequiredEnum))
|
1262 + | .transpose()?
|
1263 + | .ok_or(ConstraintViolation::MissingRequiredEnum)?,
|
1264 + | })
|
946 1265 | }
|
947 1266 | }
|
948 1267 | }
|
949 - | /// See [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
950 - | pub mod recursive_operation_input_output_nested2 {
|
1268 + | /// See [`EmptyStruct`](crate::model::EmptyStruct).
|
1269 + | pub mod empty_struct {
|
951 1270 |
|
952 - | impl ::std::convert::From<Builder> for crate::model::RecursiveOperationInputOutputNested2 {
|
1271 + | impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
|
953 1272 | fn from(builder: Builder) -> Self {
|
954 1273 | builder.build()
|
955 1274 | }
|
956 1275 | }
|
957 - | /// A builder for [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
1276 + | /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
|
958 1277 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
959 - | pub struct Builder {
|
960 - | pub(crate) bar: ::std::option::Option<::std::string::String>,
|
961 - | pub(crate) recursive_member:
|
962 - | ::std::option::Option<crate::model::RecursiveOperationInputOutputNested1>,
|
963 - | }
|
1278 + | pub struct Builder {}
|
964 1279 | impl Builder {
|
965 - | #[allow(missing_docs)] // documentation missing in model
|
966 - | pub fn bar(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
967 - | self.bar = input;
|
968 - | self
|
1280 + | /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
|
1281 + | pub fn build(self) -> crate::model::EmptyStruct {
|
1282 + | self.build_enforcing_all_constraints()
|
969 1283 | }
|
970 - | #[allow(missing_docs)] // documentation missing in model
|
971 - | pub(crate) fn set_bar(
|
972 - | mut self,
|
973 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
974 - | ) -> Self {
|
975 - | self.bar = input.map(|v| v.into());
|
976 - | self
|
1284 + | fn build_enforcing_all_constraints(self) -> crate::model::EmptyStruct {
|
1285 + | crate::model::EmptyStruct {}
|
977 1286 | }
|
978 - | #[allow(missing_docs)] // documentation missing in model
|
979 - | pub fn recursive_member(
|
980 - | mut self,
|
981 - | input: ::std::option::Option<crate::model::RecursiveOperationInputOutputNested1>,
|
982 - | ) -> Self {
|
983 - | self.recursive_member = input;
|
984 - | self
|
985 1287 | }
|
986 - | #[allow(missing_docs)] // documentation missing in model
|
987 - | pub(crate) fn set_recursive_member(
|
988 - | mut self,
|
989 - | input: Option<
|
990 - | impl ::std::convert::Into<crate::model::RecursiveOperationInputOutputNested1>,
|
991 - | >,
|
992 - | ) -> Self {
|
993 - | self.recursive_member = input.map(|v| v.into());
|
994 - | self
|
1288 + | }
|
1289 + | pub mod struct_list {
|
1290 + |
|
1291 + | #[allow(clippy::enum_variant_names)]
|
1292 + | #[derive(Debug, PartialEq)]
|
1293 + | pub enum ConstraintViolation {
|
1294 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
1295 + | /// The first component of the tuple is the index in the collection where the
|
1296 + | /// first constraint violation was found.
|
1297 + | #[doc(hidden)]
|
1298 + | Member(usize, crate::model::simple_struct::ConstraintViolation),
|
995 1299 | }
|
996 - | /// Consumes the builder and constructs a [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
997 - | pub fn build(self) -> crate::model::RecursiveOperationInputOutputNested2 {
|
998 - | self.build_enforcing_all_constraints()
|
1300 + |
|
1301 + | impl ::std::fmt::Display for ConstraintViolation {
|
1302 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1303 + | let message = match self {
|
1304 + | Self::Member(index, failing_member) => format!(
|
1305 + | "Value at index {index} failed to satisfy constraint. {}",
|
1306 + | failing_member
|
1307 + | ),
|
1308 + | };
|
1309 + | write!(f, "{message}")
|
999 1310 | }
|
1000 - | fn build_enforcing_all_constraints(
|
1311 + | }
|
1312 + |
|
1313 + | impl ::std::error::Error for ConstraintViolation {}
|
1314 + | impl ConstraintViolation {
|
1315 + | pub(crate) fn as_validation_exception_field(
|
1001 1316 | self,
|
1002 - | ) -> crate::model::RecursiveOperationInputOutputNested2 {
|
1003 - | crate::model::RecursiveOperationInputOutputNested2 {
|
1004 - | bar: self.bar,
|
1005 - | recursive_member: self.recursive_member,
|
1317 + | path: ::std::string::String,
|
1318 + | ) -> crate::model::ValidationExceptionField {
|
1319 + | match self {
|
1320 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
1321 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
1322 + | }
|
1006 1323 | }
|
1007 1324 | }
|
1325 + | }
|
1326 + | pub mod complex_list {
|
1327 + |
|
1328 + | #[allow(clippy::enum_variant_names)]
|
1329 + | #[derive(Debug, PartialEq)]
|
1330 + | pub enum ConstraintViolation {
|
1331 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
1332 + | /// The first component of the tuple is the index in the collection where the
|
1333 + | /// first constraint violation was found.
|
1334 + | #[doc(hidden)]
|
1335 + | Member(
|
1336 + | usize,
|
1337 + | ::std::boxed::Box<crate::model::complex_map::ConstraintViolation>,
|
1338 + | ),
|
1008 1339 | }
|
1009 - | }
|
1010 - | pub mod complex_union {
|
1011 1340 |
|
1012 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1013 - | #[allow(clippy::enum_variant_names)]
|
1014 - | pub enum ConstraintViolation {
|
1015 - | ComplexStruct(crate::model::complex_struct::ConstraintViolation),
|
1016 - | Structure(crate::model::simple_struct::ConstraintViolation),
|
1017 - | }
|
1018 1341 | impl ::std::fmt::Display for ConstraintViolation {
|
1019 1342 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1020 - | match self {
|
1021 - | Self::ComplexStruct(inner) => write!(f, "{inner}"),
|
1022 - | Self::Structure(inner) => write!(f, "{inner}"),
|
1023 - | }
|
1343 + | let message = match self {
|
1344 + | Self::Member(index, failing_member) => format!(
|
1345 + | "Value at index {index} failed to satisfy constraint. {}",
|
1346 + | failing_member
|
1347 + | ),
|
1348 + | };
|
1349 + | write!(f, "{message}")
|
1024 1350 | }
|
1025 1351 | }
|
1026 1352 |
|
1027 1353 | impl ::std::error::Error for ConstraintViolation {}
|
1028 1354 | impl ConstraintViolation {
|
1029 1355 | pub(crate) fn as_validation_exception_field(
|
1030 1356 | self,
|
1031 1357 | path: ::std::string::String,
|
1032 1358 | ) -> crate::model::ValidationExceptionField {
|
1033 1359 | match self {
|
1034 - | Self::ComplexStruct(inner) => {
|
1035 - | inner.as_validation_exception_field(path + "/complexStruct")
|
1036 - | }
|
1037 - | Self::Structure(inner) => inner.as_validation_exception_field(path + "/structure"),
|
1038 - | }
|
1039 - | }
|
1040 - | }
|
1041 - | }
|
1042 - | /// See [`Unit`](crate::model::Unit).
|
1043 - | pub mod unit {
|
1044 - |
|
1045 - | impl ::std::convert::From<Builder> for crate::model::Unit {
|
1046 - | fn from(builder: Builder) -> Self {
|
1047 - | builder.build()
|
1048 - | }
|
1049 - | }
|
1050 - | /// A builder for [`Unit`](crate::model::Unit).
|
1051 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1052 - | pub struct Builder {}
|
1053 - | impl Builder {
|
1054 - | /// Consumes the builder and constructs a [`Unit`](crate::model::Unit).
|
1055 - | pub fn build(self) -> crate::model::Unit {
|
1056 - | self.build_enforcing_all_constraints()
|
1360 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
1361 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
1057 1362 | }
|
1058 - | fn build_enforcing_all_constraints(self) -> crate::model::Unit {
|
1059 - | crate::model::Unit {}
|
1060 1363 | }
|
1061 1364 | }
|
1062 1365 | }
|
1063 - | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
1064 - | pub mod simple_struct {
|
1366 + | pub mod complex_map {
|
1065 1367 |
|
1066 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1067 - | /// Holds one variant for each of the ways the builder can fail.
|
1068 - | #[non_exhaustive]
|
1069 1368 | #[allow(clippy::enum_variant_names)]
|
1369 + | #[derive(Debug, PartialEq)]
|
1070 1370 | pub enum ConstraintViolation {
|
1071 - | /// Constraint violation occurred building member `r#enum` when building `SimpleStruct`.
|
1072 - | #[doc(hidden)]
|
1073 - | Enum(crate::model::suit::ConstraintViolation),
|
1074 - | /// `required_blob` was not provided but it is required when building `SimpleStruct`.
|
1075 - | MissingRequiredBlob,
|
1076 - | /// `required_boolean` was not provided but it is required when building `SimpleStruct`.
|
1077 - | MissingRequiredBoolean,
|
1078 - | /// `required_string` was not provided but it is required when building `SimpleStruct`.
|
1079 - | MissingRequiredString,
|
1080 - | /// `required_byte` was not provided but it is required when building `SimpleStruct`.
|
1081 - | MissingRequiredByte,
|
1082 - | /// `required_short` was not provided but it is required when building `SimpleStruct`.
|
1083 - | MissingRequiredShort,
|
1084 - | /// `required_integer` was not provided but it is required when building `SimpleStruct`.
|
1085 - | MissingRequiredInteger,
|
1086 - | /// `required_long` was not provided but it is required when building `SimpleStruct`.
|
1087 - | MissingRequiredLong,
|
1088 - | /// `required_float` was not provided but it is required when building `SimpleStruct`.
|
1089 - | MissingRequiredFloat,
|
1090 - | /// `required_double` was not provided but it is required when building `SimpleStruct`.
|
1091 - | MissingRequiredDouble,
|
1092 - | /// `required_timestamp` was not provided but it is required when building `SimpleStruct`.
|
1093 - | MissingRequiredTimestamp,
|
1094 - | /// `required_enum` was not provided but it is required when building `SimpleStruct`.
|
1095 - | MissingRequiredEnum,
|
1096 - | /// Constraint violation occurred building member `required_enum` when building `SimpleStruct`.
|
1097 1371 | #[doc(hidden)]
|
1098 - | RequiredEnum(crate::model::suit::ConstraintViolation),
|
1372 + | Value(
|
1373 + | ::std::string::String,
|
1374 + | ::std::boxed::Box<crate::model::complex_union::ConstraintViolation>,
|
1375 + | ),
|
1099 1376 | }
|
1377 + |
|
1100 1378 | impl ::std::fmt::Display for ConstraintViolation {
|
1101 1379 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1102 1380 | match self {
|
1103 - | ConstraintViolation::Enum(_) => write!(f, "constraint violation occurred building member `r#enum` when building `SimpleStruct`"),
|
1104 - | ConstraintViolation::MissingRequiredBlob => write!(f, "`required_blob` was not provided but it is required when building `SimpleStruct`"),
|
1105 - | ConstraintViolation::MissingRequiredBoolean => write!(f, "`required_boolean` was not provided but it is required when building `SimpleStruct`"),
|
1106 - | ConstraintViolation::MissingRequiredString => write!(f, "`required_string` was not provided but it is required when building `SimpleStruct`"),
|
1107 - | ConstraintViolation::MissingRequiredByte => write!(f, "`required_byte` was not provided but it is required when building `SimpleStruct`"),
|
1108 - | ConstraintViolation::MissingRequiredShort => write!(f, "`required_short` was not provided but it is required when building `SimpleStruct`"),
|
1109 - | ConstraintViolation::MissingRequiredInteger => write!(f, "`required_integer` was not provided but it is required when building `SimpleStruct`"),
|
1110 - | ConstraintViolation::MissingRequiredLong => write!(f, "`required_long` was not provided but it is required when building `SimpleStruct`"),
|
1111 - | ConstraintViolation::MissingRequiredFloat => write!(f, "`required_float` was not provided but it is required when building `SimpleStruct`"),
|
1112 - | ConstraintViolation::MissingRequiredDouble => write!(f, "`required_double` was not provided but it is required when building `SimpleStruct`"),
|
1113 - | ConstraintViolation::MissingRequiredTimestamp => write!(f, "`required_timestamp` was not provided but it is required when building `SimpleStruct`"),
|
1114 - | ConstraintViolation::MissingRequiredEnum => write!(f, "`required_enum` was not provided but it is required when building `SimpleStruct`"),
|
1115 - | ConstraintViolation::RequiredEnum(_) => write!(f, "constraint violation occurred building member `required_enum` when building `SimpleStruct`"),
|
1381 + | Self::Value(_, value_constraint_violation) => {
|
1382 + | write!(f, "{}", value_constraint_violation)
|
1116 1383 | }
|
1117 1384 | }
|
1118 1385 | }
|
1386 + | }
|
1387 + |
|
1119 1388 | impl ::std::error::Error for ConstraintViolation {}
|
1120 1389 | impl ConstraintViolation {
|
1121 1390 | pub(crate) fn as_validation_exception_field(
|
1122 1391 | self,
|
1123 1392 | path: ::std::string::String,
|
1124 1393 | ) -> crate::model::ValidationExceptionField {
|
1125 1394 | match self {
|
1126 - | ConstraintViolation::Enum(inner) => inner.as_validation_exception_field(path + "/enum"),
|
1127 - | ConstraintViolation::MissingRequiredBlob => crate::model::ValidationExceptionField {
|
1128 - | message: format!("Value at '{}/requiredBlob' failed to satisfy constraint: Member must not be null", path),
|
1129 - | path: path + "/requiredBlob",
|
1130 - | },
|
1131 - | ConstraintViolation::MissingRequiredBoolean => crate::model::ValidationExceptionField {
|
1132 - | message: format!("Value at '{}/requiredBoolean' failed to satisfy constraint: Member must not be null", path),
|
1133 - | path: path + "/requiredBoolean",
|
1134 - | },
|
1135 - | ConstraintViolation::MissingRequiredString => crate::model::ValidationExceptionField {
|
1136 - | message: format!("Value at '{}/requiredString' failed to satisfy constraint: Member must not be null", path),
|
1137 - | path: path + "/requiredString",
|
1138 - | },
|
1139 - | ConstraintViolation::MissingRequiredByte => crate::model::ValidationExceptionField {
|
1140 - | message: format!("Value at '{}/requiredByte' failed to satisfy constraint: Member must not be null", path),
|
1141 - | path: path + "/requiredByte",
|
1142 - | },
|
1143 - | ConstraintViolation::MissingRequiredShort => crate::model::ValidationExceptionField {
|
1144 - | message: format!("Value at '{}/requiredShort' failed to satisfy constraint: Member must not be null", path),
|
1145 - | path: path + "/requiredShort",
|
1146 - | },
|
1147 - | ConstraintViolation::MissingRequiredInteger => crate::model::ValidationExceptionField {
|
1148 - | message: format!("Value at '{}/requiredInteger' failed to satisfy constraint: Member must not be null", path),
|
1149 - | path: path + "/requiredInteger",
|
1150 - | },
|
1151 - | ConstraintViolation::MissingRequiredLong => crate::model::ValidationExceptionField {
|
1152 - | message: format!("Value at '{}/requiredLong' failed to satisfy constraint: Member must not be null", path),
|
1153 - | path: path + "/requiredLong",
|
1154 - | },
|
1155 - | ConstraintViolation::MissingRequiredFloat => crate::model::ValidationExceptionField {
|
1156 - | message: format!("Value at '{}/requiredFloat' failed to satisfy constraint: Member must not be null", path),
|
1157 - | path: path + "/requiredFloat",
|
1158 - | },
|
1159 - | ConstraintViolation::MissingRequiredDouble => crate::model::ValidationExceptionField {
|
1160 - | message: format!("Value at '{}/requiredDouble' failed to satisfy constraint: Member must not be null", path),
|
1161 - | path: path + "/requiredDouble",
|
1162 - | },
|
1163 - | ConstraintViolation::MissingRequiredTimestamp => crate::model::ValidationExceptionField {
|
1164 - | message: format!("Value at '{}/requiredTimestamp' failed to satisfy constraint: Member must not be null", path),
|
1165 - | path: path + "/requiredTimestamp",
|
1166 - | },
|
1167 - | ConstraintViolation::MissingRequiredEnum => crate::model::ValidationExceptionField {
|
1168 - | message: format!("Value at '{}/requiredEnum' failed to satisfy constraint: Member must not be null", path),
|
1169 - | path: path + "/requiredEnum",
|
1170 - | },
|
1171 - | ConstraintViolation::RequiredEnum(inner) => inner.as_validation_exception_field(path + "/requiredEnum"),
|
1172 - | }
|
1173 - | }
|
1174 - | }
|
1175 - | impl ::std::convert::From<Builder>
|
1176 - | for crate::constrained::MaybeConstrained<crate::model::SimpleStruct>
|
1177 - | {
|
1178 - | fn from(builder: Builder) -> Self {
|
1179 - | Self::Unconstrained(builder)
|
1180 - | }
|
1181 - | }
|
1182 - | impl ::std::convert::TryFrom<Builder> for crate::model::SimpleStruct {
|
1183 - | type Error = ConstraintViolation;
|
1184 - |
|
1185 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1186 - | builder.build()
|
1187 - | }
|
1188 - | }
|
1189 - | /// A builder for [`SimpleStruct`](crate::model::SimpleStruct).
|
1190 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1191 - | pub struct Builder {
|
1192 - | pub(crate) blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
1193 - | pub(crate) boolean: ::std::option::Option<bool>,
|
1194 - | pub(crate) string: ::std::option::Option<::std::string::String>,
|
1195 - | pub(crate) byte: ::std::option::Option<i8>,
|
1196 - | pub(crate) short: ::std::option::Option<i16>,
|
1197 - | pub(crate) integer: ::std::option::Option<i32>,
|
1198 - | pub(crate) long: ::std::option::Option<i64>,
|
1199 - | pub(crate) float: ::std::option::Option<f32>,
|
1200 - | pub(crate) double: ::std::option::Option<f64>,
|
1201 - | pub(crate) timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
|
1202 - | pub(crate) r#enum:
|
1203 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
1204 - | pub(crate) required_blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
1205 - | pub(crate) required_boolean: ::std::option::Option<bool>,
|
1206 - | pub(crate) required_string: ::std::option::Option<::std::string::String>,
|
1207 - | pub(crate) required_byte: ::std::option::Option<i8>,
|
1208 - | pub(crate) required_short: ::std::option::Option<i16>,
|
1209 - | pub(crate) required_integer: ::std::option::Option<i32>,
|
1210 - | pub(crate) required_long: ::std::option::Option<i64>,
|
1211 - | pub(crate) required_float: ::std::option::Option<f32>,
|
1212 - | pub(crate) required_double: ::std::option::Option<f64>,
|
1213 - | pub(crate) required_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
|
1214 - | pub(crate) required_enum:
|
1215 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
1216 - | }
|
1217 - | impl Builder {
|
1218 - | #[allow(missing_docs)] // documentation missing in model
|
1219 - | pub fn blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
|
1220 - | self.blob = input;
|
1221 - | self
|
1222 - | }
|
1223 - | #[allow(missing_docs)] // documentation missing in model
|
1224 - | pub(crate) fn set_blob(
|
1225 - | mut self,
|
1226 - | input: Option<impl ::std::convert::Into<::aws_smithy_types::Blob>>,
|
1227 - | ) -> Self {
|
1228 - | self.blob = input.map(|v| v.into());
|
1229 - | self
|
1230 - | }
|
1231 - | #[allow(missing_docs)] // documentation missing in model
|
1232 - | pub fn boolean(mut self, input: ::std::option::Option<bool>) -> Self {
|
1233 - | self.boolean = input;
|
1234 - | self
|
1235 - | }
|
1236 - | #[allow(missing_docs)] // documentation missing in model
|
1237 - | pub(crate) fn set_boolean(
|
1238 - | mut self,
|
1239 - | input: Option<impl ::std::convert::Into<bool>>,
|
1240 - | ) -> Self {
|
1241 - | self.boolean = input.map(|v| v.into());
|
1242 - | self
|
1243 - | }
|
1244 - | #[allow(missing_docs)] // documentation missing in model
|
1245 - | pub fn string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1246 - | self.string = input;
|
1247 - | self
|
1248 - | }
|
1249 - | #[allow(missing_docs)] // documentation missing in model
|
1250 - | pub(crate) fn set_string(
|
1251 - | mut self,
|
1252 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1253 - | ) -> Self {
|
1254 - | self.string = input.map(|v| v.into());
|
1255 - | self
|
1256 - | }
|
1257 - | #[allow(missing_docs)] // documentation missing in model
|
1258 - | pub fn byte(mut self, input: ::std::option::Option<i8>) -> Self {
|
1259 - | self.byte = input;
|
1260 - | self
|
1261 - | }
|
1262 - | #[allow(missing_docs)] // documentation missing in model
|
1263 - | pub(crate) fn set_byte(mut self, input: Option<impl ::std::convert::Into<i8>>) -> Self {
|
1264 - | self.byte = input.map(|v| v.into());
|
1265 - | self
|
1266 - | }
|
1267 - | #[allow(missing_docs)] // documentation missing in model
|
1268 - | pub fn short(mut self, input: ::std::option::Option<i16>) -> Self {
|
1269 - | self.short = input;
|
1270 - | self
|
1271 - | }
|
1272 - | #[allow(missing_docs)] // documentation missing in model
|
1273 - | pub(crate) fn set_short(mut self, input: Option<impl ::std::convert::Into<i16>>) -> Self {
|
1274 - | self.short = input.map(|v| v.into());
|
1275 - | self
|
1395 + | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
1396 + | .as_validation_exception_field(path + "/" + key.as_str()),
|
1276 1397 | }
|
1277 - | #[allow(missing_docs)] // documentation missing in model
|
1278 - | pub fn integer(mut self, input: ::std::option::Option<i32>) -> Self {
|
1279 - | self.integer = input;
|
1280 - | self
|
1281 1398 | }
|
1282 - | #[allow(missing_docs)] // documentation missing in model
|
1283 - | pub(crate) fn set_integer(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
|
1284 - | self.integer = input.map(|v| v.into());
|
1285 - | self
|
1286 1399 | }
|
1287 - | #[allow(missing_docs)] // documentation missing in model
|
1288 - | pub fn long(mut self, input: ::std::option::Option<i64>) -> Self {
|
1289 - | self.long = input;
|
1290 - | self
|
1400 + | }
|
1401 + | pub mod complex_union {
|
1402 + |
|
1403 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1404 + | #[allow(clippy::enum_variant_names)]
|
1405 + | pub enum ConstraintViolation {
|
1406 + | ComplexStruct(crate::model::complex_struct::ConstraintViolation),
|
1407 + | Structure(crate::model::simple_struct::ConstraintViolation),
|
1291 1408 | }
|
1292 - | #[allow(missing_docs)] // documentation missing in model
|
1293 - | pub(crate) fn set_long(mut self, input: Option<impl ::std::convert::Into<i64>>) -> Self {
|
1294 - | self.long = input.map(|v| v.into());
|
1295 - | self
|
1409 + | impl ::std::fmt::Display for ConstraintViolation {
|
1410 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1411 + | match self {
|
1412 + | Self::ComplexStruct(inner) => write!(f, "{inner}"),
|
1413 + | Self::Structure(inner) => write!(f, "{inner}"),
|
1296 1414 | }
|
1297 - | #[allow(missing_docs)] // documentation missing in model
|
1298 - | pub fn float(mut self, input: ::std::option::Option<f32>) -> Self {
|
1299 - | self.float = input;
|
1300 - | self
|
1301 1415 | }
|
1302 - | #[allow(missing_docs)] // documentation missing in model
|
1303 - | pub(crate) fn set_float(mut self, input: Option<impl ::std::convert::Into<f32>>) -> Self {
|
1304 - | self.float = input.map(|v| v.into());
|
1305 - | self
|
1306 1416 | }
|
1307 - | #[allow(missing_docs)] // documentation missing in model
|
1308 - | pub fn double(mut self, input: ::std::option::Option<f64>) -> Self {
|
1309 - | self.double = input;
|
1310 - | self
|
1417 + |
|
1418 + | impl ::std::error::Error for ConstraintViolation {}
|
1419 + | impl ConstraintViolation {
|
1420 + | pub(crate) fn as_validation_exception_field(
|
1421 + | self,
|
1422 + | path: ::std::string::String,
|
1423 + | ) -> crate::model::ValidationExceptionField {
|
1424 + | match self {
|
1425 + | Self::ComplexStruct(inner) => {
|
1426 + | inner.as_validation_exception_field(path + "/complexStruct")
|
1311 1427 | }
|
1312 - | #[allow(missing_docs)] // documentation missing in model
|
1313 - | pub(crate) fn set_double(mut self, input: Option<impl ::std::convert::Into<f64>>) -> Self {
|
1314 - | self.double = input.map(|v| v.into());
|
1315 - | self
|
1428 + | Self::Structure(inner) => inner.as_validation_exception_field(path + "/structure"),
|
1316 1429 | }
|
1317 - | #[allow(missing_docs)] // documentation missing in model
|
1318 - | pub fn timestamp(
|
1319 - | mut self,
|
1320 - | input: ::std::option::Option<::aws_smithy_types::DateTime>,
|
1321 - | ) -> Self {
|
1322 - | self.timestamp = input;
|
1323 - | self
|
1324 1430 | }
|
1325 - | #[allow(missing_docs)] // documentation missing in model
|
1326 - | pub(crate) fn set_timestamp(
|
1327 - | mut self,
|
1328 - | input: Option<impl ::std::convert::Into<::aws_smithy_types::DateTime>>,
|
1329 - | ) -> Self {
|
1330 - | self.timestamp = input.map(|v| v.into());
|
1331 - | self
|
1332 1431 | }
|
1333 - | #[allow(missing_docs)] // documentation missing in model
|
1334 - | pub fn r#enum(mut self, input: ::std::option::Option<crate::model::Suit>) -> Self {
|
1335 - | self.r#enum = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1336 - | self
|
1432 + | }
|
1433 + | /// See [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
1434 + | pub mod recursive_operation_input_output_nested1 {
|
1435 + |
|
1436 + | impl ::std::convert::From<Builder> for crate::model::RecursiveOperationInputOutputNested1 {
|
1437 + | fn from(builder: Builder) -> Self {
|
1438 + | builder.build()
|
1337 1439 | }
|
1338 - | #[allow(missing_docs)] // documentation missing in model
|
1339 - | pub(crate) fn set_enum(
|
1340 - | mut self,
|
1341 - | input: Option<
|
1342 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
1440 + | }
|
1441 + | /// A builder for [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
1442 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1443 + | pub struct Builder {
|
1444 + | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
1445 + | pub(crate) nested: ::std::option::Option<
|
1446 + | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
1343 1447 | >,
|
1344 - | ) -> Self {
|
1345 - | self.r#enum = input.map(|v| v.into());
|
1346 - | self
|
1448 + | pub(crate) variant: ::std::option::Option<crate::model::FooChoice>,
|
1347 1449 | }
|
1450 + | impl Builder {
|
1348 1451 | #[allow(missing_docs)] // documentation missing in model
|
1349 - | pub fn required_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
|
1350 - | self.required_blob = Some(input);
|
1452 + | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1453 + | self.foo = input;
|
1351 1454 | self
|
1352 1455 | }
|
1353 1456 | #[allow(missing_docs)] // documentation missing in model
|
1354 - | pub(crate) fn set_required_blob(
|
1457 + | pub(crate) fn set_foo(
|
1355 1458 | mut self,
|
1356 - | input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
|
1459 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1357 1460 | ) -> Self {
|
1358 - | self.required_blob = Some(input.into());
|
1359 - | self
|
1360 - | }
|
1361 - | #[allow(missing_docs)] // documentation missing in model
|
1362 - | pub fn required_boolean(mut self, input: bool) -> Self {
|
1363 - | self.required_boolean = Some(input);
|
1461 + | self.foo = input.map(|v| v.into());
|
1364 1462 | self
|
1365 1463 | }
|
1366 1464 | #[allow(missing_docs)] // documentation missing in model
|
1367 - | pub(crate) fn set_required_boolean(
|
1465 + | pub fn nested(
|
1368 1466 | mut self,
|
1369 - | input: impl ::std::convert::Into<bool>,
|
1467 + | input: ::std::option::Option<
|
1468 + | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
1469 + | >,
|
1370 1470 | ) -> Self {
|
1371 - | self.required_boolean = Some(input.into());
|
1372 - | self
|
1373 - | }
|
1374 - | #[allow(missing_docs)] // documentation missing in model
|
1375 - | pub fn required_string(mut self, input: ::std::string::String) -> Self {
|
1376 - | self.required_string = Some(input);
|
1471 + | self.nested = input;
|
1377 1472 | self
|
1378 1473 | }
|
1379 1474 | #[allow(missing_docs)] // documentation missing in model
|
1380 - | pub(crate) fn set_required_string(
|
1475 + | pub(crate) fn set_nested(
|
1381 1476 | mut self,
|
1382 - | input: impl ::std::convert::Into<::std::string::String>,
|
1477 + | input: Option<
|
1478 + | impl ::std::convert::Into<
|
1479 + | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
1480 + | >,
|
1481 + | >,
|
1383 1482 | ) -> Self {
|
1384 - | self.required_string = Some(input.into());
|
1385 - | self
|
1386 - | }
|
1387 - | #[allow(missing_docs)] // documentation missing in model
|
1388 - | pub fn required_byte(mut self, input: i8) -> Self {
|
1389 - | self.required_byte = Some(input);
|
1390 - | self
|
1391 - | }
|
1392 - | #[allow(missing_docs)] // documentation missing in model
|
1393 - | pub(crate) fn set_required_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
|
1394 - | self.required_byte = Some(input.into());
|
1395 - | self
|
1396 - | }
|
1397 - | #[allow(missing_docs)] // documentation missing in model
|
1398 - | pub fn required_short(mut self, input: i16) -> Self {
|
1399 - | self.required_short = Some(input);
|
1400 - | self
|
1401 - | }
|
1402 - | #[allow(missing_docs)] // documentation missing in model
|
1403 - | pub(crate) fn set_required_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
|
1404 - | self.required_short = Some(input.into());
|
1483 + | self.nested = input.map(|v| v.into());
|
1405 1484 | self
|
1406 1485 | }
|
1407 1486 | #[allow(missing_docs)] // documentation missing in model
|
1408 - | pub fn required_integer(mut self, input: i32) -> Self {
|
1409 - | self.required_integer = Some(input);
|
1487 + | pub fn variant(mut self, input: ::std::option::Option<crate::model::FooChoice>) -> Self {
|
1488 + | self.variant = input;
|
1410 1489 | self
|
1411 1490 | }
|
1412 1491 | #[allow(missing_docs)] // documentation missing in model
|
1413 - | pub(crate) fn set_required_integer(
|
1492 + | pub(crate) fn set_variant(
|
1414 1493 | mut self,
|
1415 - | input: impl ::std::convert::Into<i32>,
|
1494 + | input: Option<impl ::std::convert::Into<crate::model::FooChoice>>,
|
1416 1495 | ) -> Self {
|
1417 - | self.required_integer = Some(input.into());
|
1496 + | self.variant = input.map(|v| v.into());
|
1418 1497 | self
|
1419 1498 | }
|
1420 - | #[allow(missing_docs)] // documentation missing in model
|
1421 - | pub fn required_long(mut self, input: i64) -> Self {
|
1422 - | self.required_long = Some(input);
|
1423 - | self
|
1499 + | /// Consumes the builder and constructs a [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
1500 + | pub fn build(self) -> crate::model::RecursiveOperationInputOutputNested1 {
|
1501 + | self.build_enforcing_all_constraints()
|
1424 1502 | }
|
1425 - | #[allow(missing_docs)] // documentation missing in model
|
1426 - | pub(crate) fn set_required_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
|
1427 - | self.required_long = Some(input.into());
|
1428 - | self
|
1503 + | fn build_enforcing_all_constraints(
|
1504 + | self,
|
1505 + | ) -> crate::model::RecursiveOperationInputOutputNested1 {
|
1506 + | crate::model::RecursiveOperationInputOutputNested1 {
|
1507 + | foo: self.foo,
|
1508 + | nested: self.nested,
|
1509 + | variant: self.variant,
|
1429 1510 | }
|
1430 - | #[allow(missing_docs)] // documentation missing in model
|
1431 - | pub fn required_float(mut self, input: f32) -> Self {
|
1432 - | self.required_float = Some(input);
|
1433 - | self
|
1434 1511 | }
|
1435 - | #[allow(missing_docs)] // documentation missing in model
|
1436 - | pub(crate) fn set_required_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
|
1437 - | self.required_float = Some(input.into());
|
1438 - | self
|
1439 1512 | }
|
1440 - | #[allow(missing_docs)] // documentation missing in model
|
1441 - | pub fn required_double(mut self, input: f64) -> Self {
|
1442 - | self.required_double = Some(input);
|
1443 - | self
|
1513 + | }
|
1514 + | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1515 + | pub mod validation_exception_field {
|
1516 + |
|
1517 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1518 + | /// Holds one variant for each of the ways the builder can fail.
|
1519 + | #[non_exhaustive]
|
1520 + | #[allow(clippy::enum_variant_names)]
|
1521 + | pub enum ConstraintViolation {
|
1522 + | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
1523 + | MissingPath,
|
1524 + | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
1525 + | MissingMessage,
|
1444 1526 | }
|
1445 - | #[allow(missing_docs)] // documentation missing in model
|
1446 - | pub(crate) fn set_required_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
|
1447 - | self.required_double = Some(input.into());
|
1448 - | self
|
1527 + | impl ::std::fmt::Display for ConstraintViolation {
|
1528 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1529 + | match self {
|
1530 + | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
1531 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
1449 1532 | }
|
1450 - | #[allow(missing_docs)] // documentation missing in model
|
1451 - | pub fn required_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
|
1452 - | self.required_timestamp = Some(input);
|
1453 - | self
|
1454 1533 | }
|
1455 - | #[allow(missing_docs)] // documentation missing in model
|
1456 - | pub(crate) fn set_required_timestamp(
|
1457 - | mut self,
|
1458 - | input: impl ::std::convert::Into<::aws_smithy_types::DateTime>,
|
1459 - | ) -> Self {
|
1460 - | self.required_timestamp = Some(input.into());
|
1461 - | self
|
1462 1534 | }
|
1463 - | #[allow(missing_docs)] // documentation missing in model
|
1464 - | pub fn required_enum(mut self, input: crate::model::Suit) -> Self {
|
1465 - | self.required_enum = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1466 - | self
|
1535 + | impl ::std::error::Error for ConstraintViolation {}
|
1536 + | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
1537 + | type Error = ConstraintViolation;
|
1538 + |
|
1539 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1540 + | builder.build()
|
1467 1541 | }
|
1468 - | #[allow(missing_docs)] // documentation missing in model
|
1469 - | pub(crate) fn set_required_enum(
|
1470 - | mut self,
|
1471 - | input: impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Suit>>,
|
1472 - | ) -> Self {
|
1473 - | self.required_enum = Some(input.into());
|
1542 + | }
|
1543 + | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1544 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1545 + | pub struct Builder {
|
1546 + | pub(crate) path: ::std::option::Option<::std::string::String>,
|
1547 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
1548 + | }
|
1549 + | impl Builder {
|
1550 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
1551 + | pub fn path(mut self, input: ::std::string::String) -> Self {
|
1552 + | self.path = Some(input);
|
1474 1553 | self
|
1475 1554 | }
|
1476 - | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
1555 + | /// A detailed description of the validation failure.
|
1556 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
1557 + | self.message = Some(input);
|
1558 + | self
|
1559 + | }
|
1560 + | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1477 1561 | ///
|
1478 - | /// The builder fails to construct a [`SimpleStruct`](crate::model::SimpleStruct) if a [`ConstraintViolation`] occurs.
|
1562 + | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
1479 1563 | ///
|
1480 1564 | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1481 - | pub fn build(self) -> Result<crate::model::SimpleStruct, ConstraintViolation> {
|
1565 + | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
1482 1566 | self.build_enforcing_all_constraints()
|
1483 1567 | }
|
1484 1568 | fn build_enforcing_all_constraints(
|
1485 1569 | self,
|
1486 - | ) -> Result<crate::model::SimpleStruct, ConstraintViolation> {
|
1487 - | Ok(crate::model::SimpleStruct {
|
1488 - | blob: self.blob,
|
1489 - | boolean: self.boolean,
|
1490 - | string: self.string,
|
1491 - | byte: self.byte,
|
1492 - | short: self.short,
|
1493 - | integer: self.integer,
|
1494 - | long: self.long,
|
1495 - | float: self.float,
|
1496 - | double: self.double,
|
1497 - | timestamp: self.timestamp,
|
1498 - | r#enum: self
|
1499 - | .r#enum
|
1500 - | .map(|v| match v {
|
1501 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1502 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1503 - | })
|
1504 - | .map(|res| res.map_err(ConstraintViolation::Enum))
|
1505 - | .transpose()?,
|
1506 - | required_blob: self
|
1507 - | .required_blob
|
1508 - | .ok_or(ConstraintViolation::MissingRequiredBlob)?,
|
1509 - | required_boolean: self
|
1510 - | .required_boolean
|
1511 - | .ok_or(ConstraintViolation::MissingRequiredBoolean)?,
|
1512 - | required_string: self
|
1513 - | .required_string
|
1514 - | .ok_or(ConstraintViolation::MissingRequiredString)?,
|
1515 - | required_byte: self
|
1516 - | .required_byte
|
1517 - | .ok_or(ConstraintViolation::MissingRequiredByte)?,
|
1518 - | required_short: self
|
1519 - | .required_short
|
1520 - | .ok_or(ConstraintViolation::MissingRequiredShort)?,
|
1521 - | required_integer: self
|
1522 - | .required_integer
|
1523 - | .ok_or(ConstraintViolation::MissingRequiredInteger)?,
|
1524 - | required_long: self
|
1525 - | .required_long
|
1526 - | .ok_or(ConstraintViolation::MissingRequiredLong)?,
|
1527 - | required_float: self
|
1528 - | .required_float
|
1529 - | .ok_or(ConstraintViolation::MissingRequiredFloat)?,
|
1530 - | required_double: self
|
1531 - | .required_double
|
1532 - | .ok_or(ConstraintViolation::MissingRequiredDouble)?,
|
1533 - | required_timestamp: self
|
1534 - | .required_timestamp
|
1535 - | .ok_or(ConstraintViolation::MissingRequiredTimestamp)?,
|
1536 - | required_enum: self
|
1537 - | .required_enum
|
1538 - | .map(|v| match v {
|
1539 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1540 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1541 - | })
|
1542 - | .map(|res| res.map_err(ConstraintViolation::RequiredEnum))
|
1543 - | .transpose()?
|
1544 - | .ok_or(ConstraintViolation::MissingRequiredEnum)?,
|
1570 + | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
1571 + | Ok(crate::model::ValidationExceptionField {
|
1572 + | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
1573 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
1545 1574 | })
|
1546 1575 | }
|
1547 1576 | }
|
1548 1577 | }
|
1578 + | /// See [`Unit`](crate::model::Unit).
|
1579 + | pub mod unit {
|
1580 + |
|
1581 + | impl ::std::convert::From<Builder> for crate::model::Unit {
|
1582 + | fn from(builder: Builder) -> Self {
|
1583 + | builder.build()
|
1584 + | }
|
1585 + | }
|
1586 + | /// A builder for [`Unit`](crate::model::Unit).
|
1587 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1588 + | pub struct Builder {}
|
1589 + | impl Builder {
|
1590 + | /// Consumes the builder and constructs a [`Unit`](crate::model::Unit).
|
1591 + | pub fn build(self) -> crate::model::Unit {
|
1592 + | self.build_enforcing_all_constraints()
|
1593 + | }
|
1594 + | fn build_enforcing_all_constraints(self) -> crate::model::Unit {
|
1595 + | crate::model::Unit {}
|
1596 + | }
|
1597 + | }
|
1598 + | }
|
1549 1599 | /// See [`ComplexStruct`](crate::model::ComplexStruct).
|
1550 1600 | pub mod complex_struct {
|
1551 1601 |
|
1552 1602 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1553 1603 | /// Holds one variant for each of the ways the builder can fail.
|
1554 1604 | #[non_exhaustive]
|
1555 1605 | #[allow(clippy::enum_variant_names)]
|
1556 1606 | pub enum ConstraintViolation {
|
1557 1607 | /// Constraint violation occurred building member `structure` when building `ComplexStruct`.
|
1558 1608 | #[doc(hidden)]
|