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.
|
4 + | #[derive(
|
5 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
6 + | )]
|
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 {
|
35 + | #[allow(missing_docs)] // documentation missing in model
|
36 + | A(crate::model::Event),
|
37 + | #[allow(missing_docs)] // documentation missing in model
|
38 + | B(crate::model::Event),
|
39 + | #[allow(missing_docs)] // documentation missing in model
|
40 + | C(crate::model::Event),
|
41 + | }
|
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()
|
55 + | }
|
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 + | }
|
64 + | }
|
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 + | }
|
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 + | }
|
77 + | }
|
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 + | }
|
82 + | }
|
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()
|
93 + | }
|
94 + | }
|
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>,
|
112 + | }
|
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()
|
117 + | }
|
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 + | }
|
124 + | #[allow(missing_docs)] // documentation missing in model
|
125 + | pub fn variant(&self) -> ::std::option::Option<&crate::model::FooChoice> {
|
126 + | self.variant.as_ref()
|
127 + | }
|
128 + | }
|
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()
|
133 + | }
|
134 + | }
|
135 + | impl crate::constrained::Constrained for crate::model::RecursiveOperationInputOutputNested1 {
|
136 + | type Unconstrained = crate::model::recursive_operation_input_output_nested1::Builder;
|
137 + | }
|
138 + |
|
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()
|
180 + | }
|
181 + | }
|
182 + |
|
183 + | #[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 {
|
188 + | #[allow(missing_docs)] // documentation missing in model
|
189 + | pub bar: ::std::option::Option<::std::string::String>,
|
190 + | #[allow(missing_docs)] // documentation missing in model
|
191 + | pub recursive_member: ::std::option::Option<crate::model::RecursiveOperationInputOutputNested1>,
|
192 + | }
|
193 + | impl RecursiveOperationInputOutputNested2 {
|
194 + | #[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>,
|
393 + | #[allow(missing_docs)] // documentation missing in model
|
394 + | pub byte: ::std::option::Option<i8>,
|
395 + | #[allow(missing_docs)] // documentation missing in model
|
396 + | pub short: ::std::option::Option<i16>,
|
397 + | #[allow(missing_docs)] // documentation missing in model
|
398 + | pub integer: ::std::option::Option<i32>,
|
399 + | #[allow(missing_docs)] // documentation missing in model
|
400 + | pub long: ::std::option::Option<i64>,
|
401 + | #[allow(missing_docs)] // documentation missing in model
|
402 + | pub float: ::std::option::Option<f32>,
|
403 + | #[allow(missing_docs)] // documentation missing in model
|
404 + | pub double: ::std::option::Option<f64>,
|
405 + | #[allow(missing_docs)] // documentation missing in model
|
406 + | pub timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
|
407 + | #[allow(missing_docs)] // documentation missing in model
|
408 + | pub r#enum: ::std::option::Option<crate::model::Suit>,
|
409 + | #[allow(missing_docs)] // documentation missing in model
|
410 + | pub required_blob: ::aws_smithy_types::Blob,
|
411 + | #[allow(missing_docs)] // documentation missing in model
|
412 + | pub required_boolean: bool,
|
413 + | #[allow(missing_docs)] // documentation missing in model
|
414 + | pub required_string: ::std::string::String,
|
415 + | #[allow(missing_docs)] // documentation missing in model
|
416 + | pub required_byte: i8,
|
417 + | #[allow(missing_docs)] // documentation missing in model
|
418 + | pub required_short: i16,
|
419 + | #[allow(missing_docs)] // documentation missing in model
|
420 + | pub required_integer: i32,
|
421 + | #[allow(missing_docs)] // documentation missing in model
|
422 + | pub required_long: i64,
|
423 + | #[allow(missing_docs)] // documentation missing in model
|
424 + | pub required_float: f32,
|
425 + | #[allow(missing_docs)] // documentation missing in model
|
426 + | pub required_double: f64,
|
427 + | #[allow(missing_docs)] // documentation missing in model
|
428 + | pub required_timestamp: ::aws_smithy_types::DateTime,
|
429 + | #[allow(missing_docs)] // documentation missing in model
|
430 + | pub required_enum: crate::model::Suit,
|
431 + | }
|
432 + | impl SimpleStruct {
|
433 + | #[allow(missing_docs)] // documentation missing in model
|
434 + | pub fn blob(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
|
435 + | self.blob.as_ref()
|
436 + | }
|
437 + | #[allow(missing_docs)] // documentation missing in model
|
438 + | pub fn boolean(&self) -> ::std::option::Option<bool> {
|
439 + | self.boolean
|
440 + | }
|
441 + | #[allow(missing_docs)] // documentation missing in model
|
442 + | pub fn string(&self) -> ::std::option::Option<&str> {
|
443 + | self.string.as_deref()
|
444 + | }
|
445 + | #[allow(missing_docs)] // documentation missing in model
|
446 + | pub fn byte(&self) -> ::std::option::Option<i8> {
|
447 + | self.byte
|
448 + | }
|
449 + | #[allow(missing_docs)] // documentation missing in model
|
450 + | pub fn short(&self) -> ::std::option::Option<i16> {
|
451 + | self.short
|
452 + | }
|
453 + | #[allow(missing_docs)] // documentation missing in model
|
454 + | pub fn integer(&self) -> ::std::option::Option<i32> {
|
455 + | self.integer
|
456 + | }
|
457 + | #[allow(missing_docs)] // documentation missing in model
|
458 + | pub fn long(&self) -> ::std::option::Option<i64> {
|
459 + | self.long
|
460 + | }
|
461 + | #[allow(missing_docs)] // documentation missing in model
|
462 + | pub fn float(&self) -> ::std::option::Option<f32> {
|
463 + | self.float
|
464 + | }
|
465 + | #[allow(missing_docs)] // documentation missing in model
|
466 + | pub fn double(&self) -> ::std::option::Option<f64> {
|
467 + | self.double
|
468 + | }
|
469 + | #[allow(missing_docs)] // documentation missing in model
|
470 + | pub fn timestamp(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
|
471 + | self.timestamp.as_ref()
|
472 + | }
|
473 + | #[allow(missing_docs)] // documentation missing in model
|
474 + | pub fn r#enum(&self) -> ::std::option::Option<&crate::model::Suit> {
|
475 + | self.r#enum.as_ref()
|
476 + | }
|
477 + | #[allow(missing_docs)] // documentation missing in model
|
478 + | pub fn required_blob(&self) -> &::aws_smithy_types::Blob {
|
479 + | &self.required_blob
|
480 + | }
|
481 + | #[allow(missing_docs)] // documentation missing in model
|
482 + | pub fn required_boolean(&self) -> bool {
|
483 + | self.required_boolean
|
484 + | }
|
485 + | #[allow(missing_docs)] // documentation missing in model
|
486 + | pub fn required_string(&self) -> &str {
|
487 + | use std::ops::Deref;
|
488 + | self.required_string.deref()
|
489 + | }
|
490 + | #[allow(missing_docs)] // documentation missing in model
|
491 + | pub fn required_byte(&self) -> i8 {
|
492 + | self.required_byte
|
493 + | }
|
494 + | #[allow(missing_docs)] // documentation missing in model
|
495 + | pub fn required_short(&self) -> i16 {
|
496 + | self.required_short
|
497 + | }
|
498 + | #[allow(missing_docs)] // documentation missing in model
|
499 + | pub fn required_integer(&self) -> i32 {
|
500 + | self.required_integer
|
501 + | }
|
502 + | #[allow(missing_docs)] // documentation missing in model
|
503 + | pub fn required_long(&self) -> i64 {
|
504 + | self.required_long
|
505 + | }
|
506 + | #[allow(missing_docs)] // documentation missing in model
|
507 + | pub fn required_float(&self) -> f32 {
|
508 + | self.required_float
|
509 + | }
|
510 + | #[allow(missing_docs)] // documentation missing in model
|
511 + | pub fn required_double(&self) -> f64 {
|
512 + | self.required_double
|
513 + | }
|
514 + | #[allow(missing_docs)] // documentation missing in model
|
515 + | pub fn required_timestamp(&self) -> &::aws_smithy_types::DateTime {
|
516 + | &self.required_timestamp
|
517 + | }
|
518 + | #[allow(missing_docs)] // documentation missing in model
|
519 + | pub fn required_enum(&self) -> &crate::model::Suit {
|
520 + | &self.required_enum
|
521 + | }
|
522 + | }
|
523 + | impl SimpleStruct {
|
524 + | /// Creates a new builder-style object to manufacture [`SimpleStruct`](crate::model::SimpleStruct).
|
525 + | pub fn builder() -> crate::model::simple_struct::Builder {
|
526 + | crate::model::simple_struct::Builder::default()
|
527 + | }
|
528 + | }
|
529 + | impl crate::constrained::Constrained for crate::model::SimpleStruct {
|
530 + | type Unconstrained = crate::model::simple_struct::Builder;
|
531 + | }
|
532 + |
|
533 + | #[allow(missing_docs)] // documentation missing in model
|
534 + | #[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,
|
542 + | )]
|
543 + | pub enum Suit {
|
544 + | #[allow(missing_docs)] // documentation missing in model
|
545 + | Club,
|
546 + | #[allow(missing_docs)] // documentation missing in model
|
547 + | Diamond,
|
548 + | #[allow(missing_docs)] // documentation missing in model
|
549 + | Heart,
|
550 + | #[allow(missing_docs)] // documentation missing in model
|
551 + | Spade,
|
552 + | }
|
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 + | )
|
564 + | }
|
565 + | }
|
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 + | }
|
580 + | }
|
581 + | }
|
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 + | }
|
595 + | }
|
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()
|
604 + | }
|
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 + | }
|
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",
|
620 + | }
|
621 + | }
|
622 + | /// Returns all the `&str` representations of the enum members.
|
623 + | pub const fn values() -> &'static [&'static str] {
|
624 + | &["CLUB", "DIAMOND", "HEART", "SPADE"]
|
625 + | }
|
626 + | }
|
627 + | impl ::std::convert::AsRef<str> for Suit {
|
628 + | fn as_ref(&self) -> &str {
|
629 + | self.as_str()
|
630 + | }
|
631 + | }
|
632 + | impl crate::constrained::Constrained for Suit {
|
633 + | type Unconstrained = ::std::string::String;
|
634 + | }
|
635 + |
|
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)
|
641 + | }
|
642 + | }
|
643 + |
|
644 + | #[allow(missing_docs)] // documentation missing in model
|
645 + | #[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>,
|
649 + | #[allow(missing_docs)] // documentation missing in model
|
650 + | pub empty_structure: ::std::option::Option<crate::model::EmptyStruct>,
|
651 + | #[allow(missing_docs)] // documentation missing in model
|
652 + | pub list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
653 + | #[allow(missing_docs)] // documentation missing in model
|
654 + | pub map: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
|
655 + | #[allow(missing_docs)] // documentation missing in model
|
656 + | pub union: ::std::option::Option<crate::model::SimpleUnion>,
|
657 + | #[allow(missing_docs)] // documentation missing in model
|
658 + | pub unit_union: ::std::option::Option<crate::model::UnitUnion>,
|
659 + | #[allow(missing_docs)] // documentation missing in model
|
660 + | pub structure_list: ::std::option::Option<::std::vec::Vec<crate::model::SimpleStruct>>,
|
661 + | #[allow(missing_docs)] // documentation missing in model
|
662 + | pub complex_list: ::std::vec::Vec<
|
663 + | ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
664 + | >,
|
665 + | #[allow(missing_docs)] // documentation missing in model
|
666 + | pub complex_map: ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
667 + | #[allow(missing_docs)] // documentation missing in model
|
668 + | pub complex_union: ::std::boxed::Box<crate::model::ComplexUnion>,
|
669 + | }
|
670 + | impl ComplexStruct {
|
671 + | #[allow(missing_docs)] // documentation missing in model
|
672 + | pub fn structure(&self) -> ::std::option::Option<&crate::model::SimpleStruct> {
|
673 + | self.structure.as_ref()
|
674 + | }
|
675 + | #[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()
|
678 + | }
|
679 + | #[allow(missing_docs)] // documentation missing in model
|
680 + | pub fn list(&self) -> ::std::option::Option<&[::std::string::String]> {
|
681 + | self.list.as_deref()
|
682 + | }
|
683 + | #[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()
|
688 + | }
|
689 + | #[allow(missing_docs)] // documentation missing in model
|
690 + | pub fn union(&self) -> ::std::option::Option<&crate::model::SimpleUnion> {
|
691 + | self.union.as_ref()
|
692 + | }
|
693 + | #[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()
|
696 + | }
|
697 + | #[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()
|
700 + | }
|
701 + | #[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()
|
707 + | }
|
708 + | #[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
|
713 + | }
|
714 + | #[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()
|
724 + | }
|
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 + | #[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()
|
778 + | }
|
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,
|
795 + | }
|
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`"),
|
801 + | }
|
802 + | }
|
803 + | }
|
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()
|
810 + | }
|
811 + | }
|
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>,
|
817 + | }
|
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);
|
822 + | self
|
823 + | }
|
824 + | /// A detailed description of the validation failure.
|
825 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
826 + | self.message = Some(input);
|
827 + | self
|
828 + | }
|
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()
|
836 + | }
|
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 + | })
|
844 + | }
|
845 + | }
|
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()
|
853 + | }
|
854 + | }
|
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()
|
862 + | }
|
863 + | fn build_enforcing_all_constraints(self) -> crate::model::Event {
|
864 + | crate::model::Event {}
|
865 + | }
|
866 + | }
|
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()
|
874 + | }
|
875 + | }
|
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>,
|
884 + | }
|
885 + | impl Builder {
|
886 + | #[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;
|
889 + | self
|
890 + | }
|
891 + | #[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());
|
897 + | self
|
898 + | }
|
899 + | #[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;
|
907 + | self
|
908 + | }
|
909 + | #[allow(missing_docs)] // documentation missing in model
|
910 + | pub(crate) fn set_nested(
|
911 + | mut self,
|
912 + | input: Option<
|
913 + | impl ::std::convert::Into<
|
914 + | ::std::boxed::Box<crate::model::RecursiveOperationInputOutputNested2>,
|
915 + | >,
|
916 + | >,
|
917 + | ) -> Self {
|
918 + | self.nested = input.map(|v| v.into());
|
919 + | self
|
920 + | }
|
921 + | #[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;
|
924 + | self
|
925 + | }
|
926 + | #[allow(missing_docs)] // documentation missing in model
|
927 + | pub(crate) fn set_variant(
|
928 + | mut self,
|
929 + | input: Option<impl ::std::convert::Into<crate::model::FooChoice>>,
|
930 + | ) -> Self {
|
931 + | self.variant = input.map(|v| v.into());
|
932 + | self
|
933 + | }
|
934 + | /// Consumes the builder and constructs a [`RecursiveOperationInputOutputNested1`](crate::model::RecursiveOperationInputOutputNested1).
|
935 + | pub fn build(self) -> crate::model::RecursiveOperationInputOutputNested1 {
|
936 + | self.build_enforcing_all_constraints()
|
937 + | }
|
938 + | fn build_enforcing_all_constraints(
|
939 + | self,
|
940 + | ) -> crate::model::RecursiveOperationInputOutputNested1 {
|
941 + | crate::model::RecursiveOperationInputOutputNested1 {
|
942 + | foo: self.foo,
|
943 + | nested: self.nested,
|
944 + | variant: self.variant,
|
945 + | }
|
946 + | }
|
947 + | }
|
948 + | }
|
949 + | /// See [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
950 + | pub mod recursive_operation_input_output_nested2 {
|
951 + |
|
952 + | impl ::std::convert::From<Builder> for crate::model::RecursiveOperationInputOutputNested2 {
|
953 + | fn from(builder: Builder) -> Self {
|
954 + | builder.build()
|
955 + | }
|
956 + | }
|
957 + | /// A builder for [`RecursiveOperationInputOutputNested2`](crate::model::RecursiveOperationInputOutputNested2).
|
958 + | #[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 + | }
|
964 + | 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
|
969 + | }
|
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
|
977 + | }
|
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 + | }
|
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
|
995 + | }
|
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()
|
999 + | }
|
1000 + | fn build_enforcing_all_constraints(
|
1001 + | self,
|
1002 + | ) -> crate::model::RecursiveOperationInputOutputNested2 {
|
1003 + | crate::model::RecursiveOperationInputOutputNested2 {
|
1004 + | bar: self.bar,
|
1005 + | recursive_member: self.recursive_member,
|
1006 + | }
|
1007 + | }
|
1008 + | }
|
1009 + | }
|
1010 + | pub mod complex_union {
|
1011 + |
|
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 + | impl ::std::fmt::Display for ConstraintViolation {
|
1019 + | 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 + | }
|
1024 + | }
|
1025 + | }
|
1026 + |
|
1027 + | impl ::std::error::Error for ConstraintViolation {}
|
1028 + | impl ConstraintViolation {
|
1029 + | pub(crate) fn as_validation_exception_field(
|
1030 + | self,
|
1031 + | path: ::std::string::String,
|
1032 + | ) -> crate::model::ValidationExceptionField {
|
1033 + | 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()
|
1057 + | }
|
1058 + | fn build_enforcing_all_constraints(self) -> crate::model::Unit {
|
1059 + | crate::model::Unit {}
|
1060 + | }
|
1061 + | }
|
1062 + | }
|
1063 + | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
1064 + | pub mod simple_struct {
|
1065 + |
|
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 + | #[allow(clippy::enum_variant_names)]
|
1070 + | 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 + | #[doc(hidden)]
|
1098 + | RequiredEnum(crate::model::suit::ConstraintViolation),
|
1099 + | }
|
1100 + | impl ::std::fmt::Display for ConstraintViolation {
|
1101 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1102 + | 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`"),
|
1116 + | }
|
1117 + | }
|
1118 + | }
|
1119 + | impl ::std::error::Error for ConstraintViolation {}
|
1120 + | impl ConstraintViolation {
|
1121 + | pub(crate) fn as_validation_exception_field(
|
1122 + | self,
|
1123 + | path: ::std::string::String,
|
1124 + | ) -> crate::model::ValidationExceptionField {
|
1125 + | 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
|
1276 + | }
|
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 + | }
|
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 + | }
|
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
|
1291 + | }
|
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
|
1296 + | }
|
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 + | }
|
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 + | }
|
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
|
1311 + | }
|
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
|
1316 + | }
|
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 + | }
|
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 + | }
|
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
|
1337 + | }
|
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>>,
|
1343 + | >,
|
1344 + | ) -> Self {
|
1345 + | self.r#enum = input.map(|v| v.into());
|
1346 + | self
|
1347 + | }
|
1348 + | #[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);
|
1351 + | self
|
1352 + | }
|
1353 + | #[allow(missing_docs)] // documentation missing in model
|
1354 + | pub(crate) fn set_required_blob(
|
1355 + | mut self,
|
1356 + | input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
|
1357 + | ) -> 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);
|
1364 + | self
|
1365 + | }
|
1366 + | #[allow(missing_docs)] // documentation missing in model
|
1367 + | pub(crate) fn set_required_boolean(
|
1368 + | mut self,
|
1369 + | input: impl ::std::convert::Into<bool>,
|
1370 + | ) -> 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);
|
1377 + | self
|
1378 + | }
|
1379 + | #[allow(missing_docs)] // documentation missing in model
|
1380 + | pub(crate) fn set_required_string(
|
1381 + | mut self,
|
1382 + | input: impl ::std::convert::Into<::std::string::String>,
|
1383 + | ) -> 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());
|
1405 + | self
|
1406 + | }
|
1407 + | #[allow(missing_docs)] // documentation missing in model
|
1408 + | pub fn required_integer(mut self, input: i32) -> Self {
|
1409 + | self.required_integer = Some(input);
|
1410 + | self
|
1411 + | }
|
1412 + | #[allow(missing_docs)] // documentation missing in model
|
1413 + | pub(crate) fn set_required_integer(
|
1414 + | mut self,
|
1415 + | input: impl ::std::convert::Into<i32>,
|
1416 + | ) -> Self {
|
1417 + | self.required_integer = Some(input.into());
|
1418 + | self
|
1419 + | }
|
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
|
1424 + | }
|
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
|
1429 + | }
|
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 + | }
|
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 + | }
|
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
|
1444 + | }
|
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
|
1449 + | }
|
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 + | }
|
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 + | }
|
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
|
1467 + | }
|
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());
|
1474 + | self
|
1475 + | }
|
1476 + | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
1477 + | ///
|
1478 + | /// The builder fails to construct a [`SimpleStruct`](crate::model::SimpleStruct) if a [`ConstraintViolation`] occurs.
|
1479 + | ///
|
1480 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1481 + | pub fn build(self) -> Result<crate::model::SimpleStruct, ConstraintViolation> {
|
1482 + | self.build_enforcing_all_constraints()
|
1483 + | }
|
1484 + | fn build_enforcing_all_constraints(
|
1485 + | 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)?,
|
1545 + | })
|
1546 + | }
|
1547 + | }
|
1548 + | }
|
1549 + | /// See [`ComplexStruct`](crate::model::ComplexStruct).
|
1550 + | pub mod complex_struct {
|
1551 + |
|
1552 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1553 + | /// Holds one variant for each of the ways the builder can fail.
|
1554 + | #[non_exhaustive]
|
1555 + | #[allow(clippy::enum_variant_names)]
|
1556 + | pub enum ConstraintViolation {
|
1557 + | /// Constraint violation occurred building member `structure` when building `ComplexStruct`.
|
1558 + | #[doc(hidden)]
|
1559 + | Structure(crate::model::simple_struct::ConstraintViolation),
|
1560 + | /// Constraint violation occurred building member `structure_list` when building `ComplexStruct`.
|
1561 + | #[doc(hidden)]
|
1562 + | StructureList(crate::model::struct_list::ConstraintViolation),
|
1563 + | /// `complex_list` was not provided but it is required when building `ComplexStruct`.
|
1564 + | MissingComplexList,
|
1565 + | /// Constraint violation occurred building member `complex_list` when building `ComplexStruct`.
|
1566 + | #[doc(hidden)]
|
1567 + | ComplexList(crate::model::complex_list::ConstraintViolation),
|
1568 + | /// `complex_map` was not provided but it is required when building `ComplexStruct`.
|
1569 + | MissingComplexMap,
|
1570 + | /// Constraint violation occurred building member `complex_map` when building `ComplexStruct`.
|
1571 + | #[doc(hidden)]
|
1572 + | ComplexMap(crate::model::complex_map::ConstraintViolation),
|
1573 + | /// `complex_union` was not provided but it is required when building `ComplexStruct`.
|
1574 + | MissingComplexUnion,
|
1575 + | /// Constraint violation occurred building member `complex_union` when building `ComplexStruct`.
|
1576 + | #[doc(hidden)]
|
1577 + | ComplexUnion(::std::boxed::Box<crate::model::complex_union::ConstraintViolation>),
|
1578 + | }
|
1579 + | impl ::std::fmt::Display for ConstraintViolation {
|
1580 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1581 + | match self {
|
1582 + | ConstraintViolation::Structure(_) => write!(f, "constraint violation occurred building member `structure` when building `ComplexStruct`"),
|
1583 + | ConstraintViolation::StructureList(_) => write!(f, "constraint violation occurred building member `structure_list` when building `ComplexStruct`"),
|
1584 + | ConstraintViolation::MissingComplexList => write!(f, "`complex_list` was not provided but it is required when building `ComplexStruct`"),
|
1585 + | ConstraintViolation::ComplexList(_) => write!(f, "constraint violation occurred building member `complex_list` when building `ComplexStruct`"),
|
1586 + | ConstraintViolation::MissingComplexMap => write!(f, "`complex_map` was not provided but it is required when building `ComplexStruct`"),
|
1587 + | ConstraintViolation::ComplexMap(_) => write!(f, "constraint violation occurred building member `complex_map` when building `ComplexStruct`"),
|
1588 + | ConstraintViolation::MissingComplexUnion => write!(f, "`complex_union` was not provided but it is required when building `ComplexStruct`"),
|
1589 + | ConstraintViolation::ComplexUnion(_) => write!(f, "constraint violation occurred building member `complex_union` when building `ComplexStruct`"),
|
1590 + | }
|
1591 + | }
|
1592 + | }
|
1593 + | impl ::std::error::Error for ConstraintViolation {}
|
1594 + | impl ConstraintViolation {
|
1595 + | pub(crate) fn as_validation_exception_field(
|
1596 + | self,
|
1597 + | path: ::std::string::String,
|
1598 + | ) -> crate::model::ValidationExceptionField {
|
1599 + | match self {
|
1600 + | ConstraintViolation::Structure(inner) => inner.as_validation_exception_field(path + "/structure"),
|
1601 + | ConstraintViolation::StructureList(inner) => inner.as_validation_exception_field(path + "/structureList"),
|
1602 + | ConstraintViolation::MissingComplexList => crate::model::ValidationExceptionField {
|
1603 + | message: format!("Value at '{}/complexList' failed to satisfy constraint: Member must not be null", path),
|
1604 + | path: path + "/complexList",
|
1605 + | },
|
1606 + | ConstraintViolation::ComplexList(inner) => inner.as_validation_exception_field(path + "/complexList"),
|
1607 + | ConstraintViolation::MissingComplexMap => crate::model::ValidationExceptionField {
|
1608 + | message: format!("Value at '{}/complexMap' failed to satisfy constraint: Member must not be null", path),
|
1609 + | path: path + "/complexMap",
|
1610 + | },
|
1611 + | ConstraintViolation::ComplexMap(inner) => inner.as_validation_exception_field(path + "/complexMap"),
|
1612 + | ConstraintViolation::MissingComplexUnion => crate::model::ValidationExceptionField {
|
1613 + | message: format!("Value at '{}/complexUnion' failed to satisfy constraint: Member must not be null", path),
|
1614 + | path: path + "/complexUnion",
|
1615 + | },
|
1616 + | ConstraintViolation::ComplexUnion(inner) => inner.as_validation_exception_field(path + "/complexUnion"),
|
1617 + | }
|
1618 + | }
|
1619 + | }
|
1620 + | impl ::std::convert::From<Builder>
|
1621 + | for crate::constrained::MaybeConstrained<crate::model::ComplexStruct>
|
1622 + | {
|
1623 + | fn from(builder: Builder) -> Self {
|
1624 + | Self::Unconstrained(builder)
|
1625 + | }
|
1626 + | }
|
1627 + | impl ::std::convert::TryFrom<Builder> for crate::model::ComplexStruct {
|
1628 + | type Error = ConstraintViolation;
|
1629 + |
|
1630 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1631 + | builder.build()
|
1632 + | }
|
1633 + | }
|
1634 + | /// A builder for [`ComplexStruct`](crate::model::ComplexStruct).
|
1635 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1636 + | pub struct Builder {
|
1637 + | pub(crate) structure:
|
1638 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SimpleStruct>>,
|
1639 + | pub(crate) empty_structure: ::std::option::Option<crate::model::EmptyStruct>,
|
1640 + | pub(crate) list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
1641 + | pub(crate) map:
|
1642 + | ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
|
1643 + | pub(crate) union: ::std::option::Option<crate::model::SimpleUnion>,
|
1644 + | pub(crate) unit_union: ::std::option::Option<crate::model::UnitUnion>,
|
1645 + | pub(crate) structure_list: ::std::option::Option<
|
1646 + | crate::constrained::MaybeConstrained<
|
1647 + | crate::constrained::struct_list_constrained::StructListConstrained,
|
1648 + | >,
|
1649 + | >,
|
1650 + | pub(crate) complex_list: ::std::option::Option<
|
1651 + | crate::constrained::MaybeConstrained<
|
1652 + | crate::constrained::complex_list_constrained::ComplexListConstrained,
|
1653 + | >,
|
1654 + | >,
|
1655 + | pub(crate) complex_map: ::std::option::Option<
|
1656 + | crate::constrained::MaybeConstrained<
|
1657 + | crate::constrained::complex_map_constrained::ComplexMapConstrained,
|
1658 + | >,
|
1659 + | >,
|
1660 + | pub(crate) complex_union: ::std::option::Option<
|
1661 + | ::std::boxed::Box<crate::constrained::MaybeConstrained<crate::model::ComplexUnion>>,
|
1662 + | >,
|
1663 + | }
|
1664 + | impl Builder {
|
1665 + | #[allow(missing_docs)] // documentation missing in model
|
1666 + | pub fn structure(
|
1667 + | mut self,
|
1668 + | input: ::std::option::Option<crate::model::SimpleStruct>,
|
1669 + | ) -> Self {
|
1670 + | self.structure = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1671 + | self
|
1672 + | }
|
1673 + | #[allow(missing_docs)] // documentation missing in model
|
1674 + | pub(crate) fn set_structure(
|
1675 + | mut self,
|
1676 + | input: Option<
|
1677 + | impl ::std::convert::Into<
|
1678 + | crate::constrained::MaybeConstrained<crate::model::SimpleStruct>,
|
1679 + | >,
|
1680 + | >,
|
1681 + | ) -> Self {
|
1682 + | self.structure = input.map(|v| v.into());
|
1683 + | self
|
1684 + | }
|
1685 + | #[allow(missing_docs)] // documentation missing in model
|
1686 + | pub fn empty_structure(
|
1687 + | mut self,
|
1688 + | input: ::std::option::Option<crate::model::EmptyStruct>,
|
1689 + | ) -> Self {
|
1690 + | self.empty_structure = input;
|
1691 + | self
|
1692 + | }
|
1693 + | #[allow(missing_docs)] // documentation missing in model
|
1694 + | pub(crate) fn set_empty_structure(
|
1695 + | mut self,
|
1696 + | input: Option<impl ::std::convert::Into<crate::model::EmptyStruct>>,
|
1697 + | ) -> Self {
|
1698 + | self.empty_structure = input.map(|v| v.into());
|
1699 + | self
|
1700 + | }
|
1701 + | #[allow(missing_docs)] // documentation missing in model
|
1702 + | pub fn list(
|
1703 + | mut self,
|
1704 + | input: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
1705 + | ) -> Self {
|
1706 + | self.list = input;
|
1707 + | self
|
1708 + | }
|
1709 + | #[allow(missing_docs)] // documentation missing in model
|
1710 + | pub(crate) fn set_list(
|
1711 + | mut self,
|
1712 + | input: Option<impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>>,
|
1713 + | ) -> Self {
|
1714 + | self.list = input.map(|v| v.into());
|
1715 + | self
|
1716 + | }
|
1717 + | #[allow(missing_docs)] // documentation missing in model
|
1718 + | pub fn map(
|
1719 + | mut self,
|
1720 + | input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
|
1721 + | ) -> Self {
|
1722 + | self.map = input;
|
1723 + | self
|
1724 + | }
|
1725 + | #[allow(missing_docs)] // documentation missing in model
|
1726 + | pub(crate) fn set_map(
|
1727 + | mut self,
|
1728 + | input: Option<
|
1729 + | impl ::std::convert::Into<::std::collections::HashMap<::std::string::String, i32>>,
|
1730 + | >,
|
1731 + | ) -> Self {
|
1732 + | self.map = input.map(|v| v.into());
|
1733 + | self
|
1734 + | }
|
1735 + | #[allow(missing_docs)] // documentation missing in model
|
1736 + | pub fn union(mut self, input: ::std::option::Option<crate::model::SimpleUnion>) -> Self {
|
1737 + | self.union = input;
|
1738 + | self
|
1739 + | }
|
1740 + | #[allow(missing_docs)] // documentation missing in model
|
1741 + | pub(crate) fn set_union(
|
1742 + | mut self,
|
1743 + | input: Option<impl ::std::convert::Into<crate::model::SimpleUnion>>,
|
1744 + | ) -> Self {
|
1745 + | self.union = input.map(|v| v.into());
|
1746 + | self
|
1747 + | }
|
1748 + | #[allow(missing_docs)] // documentation missing in model
|
1749 + | pub fn unit_union(mut self, input: ::std::option::Option<crate::model::UnitUnion>) -> Self {
|
1750 + | self.unit_union = input;
|
1751 + | self
|
1752 + | }
|
1753 + | #[allow(missing_docs)] // documentation missing in model
|
1754 + | pub(crate) fn set_unit_union(
|
1755 + | mut self,
|
1756 + | input: Option<impl ::std::convert::Into<crate::model::UnitUnion>>,
|
1757 + | ) -> Self {
|
1758 + | self.unit_union = input.map(|v| v.into());
|
1759 + | self
|
1760 + | }
|
1761 + | #[allow(missing_docs)] // documentation missing in model
|
1762 + | pub fn structure_list(
|
1763 + | mut self,
|
1764 + | input: ::std::option::Option<::std::vec::Vec<crate::model::SimpleStruct>>,
|
1765 + | ) -> Self {
|
1766 + | self.structure_list =
|
1767 + | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
1768 + | self
|
1769 + | }
|
1770 + | #[allow(missing_docs)] // documentation missing in model
|
1771 + | pub(crate) fn set_structure_list(
|
1772 + | mut self,
|
1773 + | input: Option<
|
1774 + | impl ::std::convert::Into<
|
1775 + | crate::constrained::MaybeConstrained<
|
1776 + | crate::constrained::struct_list_constrained::StructListConstrained,
|
1777 + | >,
|
1778 + | >,
|
1779 + | >,
|
1780 + | ) -> Self {
|
1781 + | self.structure_list = input.map(|v| v.into());
|
1782 + | self
|
1783 + | }
|
1784 + | #[allow(missing_docs)] // documentation missing in model
|
1785 + | pub fn complex_list(
|
1786 + | mut self,
|
1787 + | input: ::std::vec::Vec<
|
1788 + | ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
1789 + | >,
|
1790 + | ) -> Self {
|
1791 + | self.complex_list = Some(crate::constrained::MaybeConstrained::Constrained(
|
1792 + | (input).into(),
|
1793 + | ));
|
1794 + | self
|
1795 + | }
|
1796 + | #[allow(missing_docs)] // documentation missing in model
|
1797 + | pub(crate) fn set_complex_list(
|
1798 + | mut self,
|
1799 + | input: impl ::std::convert::Into<
|
1800 + | crate::constrained::MaybeConstrained<
|
1801 + | crate::constrained::complex_list_constrained::ComplexListConstrained,
|
1802 + | >,
|
1803 + | >,
|
1804 + | ) -> Self {
|
1805 + | self.complex_list = Some(input.into());
|
1806 + | self
|
1807 + | }
|
1808 + | #[allow(missing_docs)] // documentation missing in model
|
1809 + | pub fn complex_map(
|
1810 + | mut self,
|
1811 + | input: ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
|
1812 + | ) -> Self {
|
1813 + | self.complex_map = Some(crate::constrained::MaybeConstrained::Constrained(
|
1814 + | (input).into(),
|
1815 + | ));
|
1816 + | self
|
1817 + | }
|
1818 + | #[allow(missing_docs)] // documentation missing in model
|
1819 + | pub(crate) fn set_complex_map(
|
1820 + | mut self,
|
1821 + | input: impl ::std::convert::Into<
|
1822 + | crate::constrained::MaybeConstrained<
|
1823 + | crate::constrained::complex_map_constrained::ComplexMapConstrained,
|
1824 + | >,
|
1825 + | >,
|
1826 + | ) -> Self {
|
1827 + | self.complex_map = Some(input.into());
|
1828 + | self
|
1829 + | }
|
1830 + | #[allow(missing_docs)] // documentation missing in model
|
1831 + | #[allow(clippy::boxed_local)]
|
1832 + | pub fn complex_union(
|
1833 + | mut self,
|
1834 + | input: ::std::boxed::Box<crate::model::ComplexUnion>,
|
1835 + | ) -> Self {
|
1836 + | self.complex_union = Some(Box::new(crate::constrained::MaybeConstrained::Constrained(
|
1837 + | *input,
|
1838 + | )));
|
1839 + | self
|
1840 + | }
|
1841 + | #[allow(missing_docs)] // documentation missing in model
|
1842 + | pub(crate) fn set_complex_union(
|
1843 + | mut self,
|
1844 + | input: impl ::std::convert::Into<
|
1845 + | ::std::boxed::Box<crate::constrained::MaybeConstrained<crate::model::ComplexUnion>>,
|
1846 + | >,
|
1847 + | ) -> Self {
|
1848 + | self.complex_union = Some(input.into());
|
1849 + | self
|
1850 + | }
|
1851 + | /// Consumes the builder and constructs a [`ComplexStruct`](crate::model::ComplexStruct).
|
1852 + | ///
|
1853 + | /// The builder fails to construct a [`ComplexStruct`](crate::model::ComplexStruct) if a [`ConstraintViolation`] occurs.
|
1854 + | ///
|
1855 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1856 + | pub fn build(self) -> Result<crate::model::ComplexStruct, ConstraintViolation> {
|
1857 + | self.build_enforcing_all_constraints()
|
1858 + | }
|
1859 + | fn build_enforcing_all_constraints(
|
1860 + | self,
|
1861 + | ) -> Result<crate::model::ComplexStruct, ConstraintViolation> {
|
1862 + | Ok(crate::model::ComplexStruct {
|
1863 + | structure: self
|
1864 + | .structure
|
1865 + | .map(|v| match v {
|
1866 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1867 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1868 + | })
|
1869 + | .map(|res| res.map_err(ConstraintViolation::Structure))
|
1870 + | .transpose()?,
|
1871 + | empty_structure: self.empty_structure,
|
1872 + | list: self.list,
|
1873 + | map: self.map,
|
1874 + | union: self.union,
|
1875 + | unit_union: self.unit_union,
|
1876 + | structure_list: self
|
1877 + | .structure_list
|
1878 + | .map(|v| match v {
|
1879 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1880 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1881 + | })
|
1882 + | .map(|res| {
|
1883 + | res.map(|v| v.into())
|
1884 + | .map_err(ConstraintViolation::StructureList)
|
1885 + | })
|
1886 + | .transpose()?,
|
1887 + | complex_list: self
|
1888 + | .complex_list
|
1889 + | .map(|v| match v {
|
1890 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1891 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1892 + | })
|
1893 + | .map(|res| {
|
1894 + | res.map(|v| v.into())
|
1895 + | .map_err(ConstraintViolation::ComplexList)
|
1896 + | })
|
1897 + | .transpose()?
|
1898 + | .ok_or(ConstraintViolation::MissingComplexList)?,
|
1899 + | complex_map: self
|
1900 + | .complex_map
|
1901 + | .map(|v| match v {
|
1902 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1903 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1904 + | })
|
1905 + | .map(|res| {
|
1906 + | res.map(|v| v.into())
|
1907 + | .map_err(ConstraintViolation::ComplexMap)
|
1908 + | })
|
1909 + | .transpose()?
|
1910 + | .ok_or(ConstraintViolation::MissingComplexMap)?,
|
1911 + | complex_union: self
|
1912 + | .complex_union
|
1913 + | .map(|v| match *v {
|
1914 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(Box::new(x)),
|
1915 + | crate::constrained::MaybeConstrained::Unconstrained(x) => {
|
1916 + | Ok(Box::new(x.try_into()?))
|
1917 + | }
|
1918 + | })
|
1919 + | .map(|res| {
|
1920 + | res.map_err(Box::new)
|
1921 + | .map_err(ConstraintViolation::ComplexUnion)
|
1922 + | })
|
1923 + | .transpose()?
|
1924 + | .ok_or(ConstraintViolation::MissingComplexUnion)?,
|
1925 + | })
|
1926 + | }
|
1927 + | }
|
1928 + | }
|
1929 + | pub mod complex_map {
|
1930 + |
|
1931 + | #[allow(clippy::enum_variant_names)]
|
1932 + | #[derive(Debug, PartialEq)]
|
1933 + | pub enum ConstraintViolation {
|
1934 + | #[doc(hidden)]
|
1935 + | Value(
|
1936 + | ::std::string::String,
|
1937 + | ::std::boxed::Box<crate::model::complex_union::ConstraintViolation>,
|
1938 + | ),
|
1939 + | }
|
1940 + |
|
1941 + | impl ::std::fmt::Display for ConstraintViolation {
|
1942 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1943 + | match self {
|
1944 + | Self::Value(_, value_constraint_violation) => {
|
1945 + | write!(f, "{}", value_constraint_violation)
|
1946 + | }
|
1947 + | }
|
1948 + | }
|
1949 + | }
|
1950 + |
|
1951 + | impl ::std::error::Error for ConstraintViolation {}
|
1952 + | impl ConstraintViolation {
|
1953 + | pub(crate) fn as_validation_exception_field(
|
1954 + | self,
|
1955 + | path: ::std::string::String,
|
1956 + | ) -> crate::model::ValidationExceptionField {
|
1957 + | match self {
|
1958 + | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
1959 + | .as_validation_exception_field(path + "/" + key.as_str()),
|
1960 + | }
|
1961 + | }
|
1962 + | }
|
1963 + | }
|
1964 + | pub mod complex_list {
|
1965 + |
|
1966 + | #[allow(clippy::enum_variant_names)]
|
1967 + | #[derive(Debug, PartialEq)]
|
1968 + | pub enum ConstraintViolation {
|
1969 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
1970 + | /// The first component of the tuple is the index in the collection where the
|
1971 + | /// first constraint violation was found.
|
1972 + | #[doc(hidden)]
|
1973 + | Member(
|
1974 + | usize,
|
1975 + | ::std::boxed::Box<crate::model::complex_map::ConstraintViolation>,
|
1976 + | ),
|
1977 + | }
|
1978 + |
|
1979 + | impl ::std::fmt::Display for ConstraintViolation {
|
1980 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1981 + | let message = match self {
|
1982 + | Self::Member(index, failing_member) => format!(
|
1983 + | "Value at index {index} failed to satisfy constraint. {}",
|
1984 + | failing_member
|
1985 + | ),
|
1986 + | };
|
1987 + | write!(f, "{message}")
|
1988 + | }
|
1989 + | }
|
1990 + |
|
1991 + | impl ::std::error::Error for ConstraintViolation {}
|
1992 + | impl ConstraintViolation {
|
1993 + | pub(crate) fn as_validation_exception_field(
|
1994 + | self,
|
1995 + | path: ::std::string::String,
|
1996 + | ) -> crate::model::ValidationExceptionField {
|
1997 + | match self {
|
1998 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
1999 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
2000 + | }
|
2001 + | }
|
2002 + | }
|
2003 + | }
|
2004 + | pub mod struct_list {
|
2005 + |
|
2006 + | #[allow(clippy::enum_variant_names)]
|
2007 + | #[derive(Debug, PartialEq)]
|
2008 + | pub enum ConstraintViolation {
|
2009 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
2010 + | /// The first component of the tuple is the index in the collection where the
|
2011 + | /// first constraint violation was found.
|
2012 + | #[doc(hidden)]
|
2013 + | Member(usize, crate::model::simple_struct::ConstraintViolation),
|
2014 + | }
|
2015 + |
|
2016 + | impl ::std::fmt::Display for ConstraintViolation {
|
2017 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2018 + | let message = match self {
|
2019 + | Self::Member(index, failing_member) => format!(
|
2020 + | "Value at index {index} failed to satisfy constraint. {}",
|
2021 + | failing_member
|
2022 + | ),
|
2023 + | };
|
2024 + | write!(f, "{message}")
|
2025 + | }
|
2026 + | }
|
2027 + |
|
2028 + | impl ::std::error::Error for ConstraintViolation {}
|
2029 + | impl ConstraintViolation {
|
2030 + | pub(crate) fn as_validation_exception_field(
|
2031 + | self,
|
2032 + | path: ::std::string::String,
|
2033 + | ) -> crate::model::ValidationExceptionField {
|
2034 + | match self {
|
2035 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
2036 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
2037 + | }
|
2038 + | }
|
2039 + | }
|
2040 + | }
|
2041 + | /// See [`EmptyStruct`](crate::model::EmptyStruct).
|
2042 + | pub mod empty_struct {
|
2043 + |
|
2044 + | impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
|
2045 + | fn from(builder: Builder) -> Self {
|
2046 + | builder.build()
|
2047 + | }
|
2048 + | }
|
2049 + | /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
|
2050 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2051 + | pub struct Builder {}
|
2052 + | impl Builder {
|
2053 + | /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
|
2054 + | pub fn build(self) -> crate::model::EmptyStruct {
|
2055 + | self.build_enforcing_all_constraints()
|
2056 + | }
|
2057 + | fn build_enforcing_all_constraints(self) -> crate::model::EmptyStruct {
|
2058 + | crate::model::EmptyStruct {}
|
2059 + | }
|
2060 + | }
|
2061 + | }
|