1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - |
|
3 - | /// Describes one specific validation failure for an input member.
|
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,
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
3 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
4 + | pub enum AttemptCapturingPokemonEvent {
|
5 + | #[allow(missing_docs)] // documentation missing in model
|
6 + | Event(crate::model::CapturingEvent),
|
12 7 | }
|
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()
|
8 + | impl AttemptCapturingPokemonEvent {
|
9 + | #[allow(irrefutable_let_patterns)]
|
10 + | /// Tries to convert the enum instance into [`Event`](crate::model::AttemptCapturingPokemonEvent::Event), extracting the inner [`CapturingEvent`](crate::model::CapturingEvent).
|
11 + | /// Returns `Err(&Self)` if it can't be converted.
|
12 + | pub fn as_event(&self) -> ::std::result::Result<&crate::model::CapturingEvent, &Self> {
|
13 + | if let AttemptCapturingPokemonEvent::Event(val) = &self {
|
14 + | ::std::result::Result::Ok(val)
|
15 + | } else {
|
16 + | ::std::result::Result::Err(self)
|
17 + | }
|
23 18 | }
|
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()
|
19 + | /// Returns true if this is a [`Event`](crate::model::AttemptCapturingPokemonEvent::Event).
|
20 + | pub fn is_event(&self) -> bool {
|
21 + | self.as_event().is_ok()
|
29 22 | }
|
30 23 | }
|
31 24 |
|
32 25 | #[allow(missing_docs)] // documentation missing in model
|
33 26 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
34 27 | pub enum CapturePokemonEvents {
|
35 28 | #[allow(missing_docs)] // documentation missing in model
|
36 29 | Event(crate::model::CaptureEvent),
|
37 30 | }
|
38 31 | impl CapturePokemonEvents {
|
39 32 | #[allow(irrefutable_let_patterns)]
|
40 33 | /// Tries to convert the enum instance into [`Event`](crate::model::CapturePokemonEvents::Event), extracting the inner [`CaptureEvent`](crate::model::CaptureEvent).
|
41 34 | /// Returns `Err(&Self)` if it can't be converted.
|
42 35 | pub fn as_event(&self) -> ::std::result::Result<&crate::model::CaptureEvent, &Self> {
|
43 36 | if let CapturePokemonEvents::Event(val) = &self {
|
44 37 | ::std::result::Result::Ok(val)
|
45 38 | } else {
|
46 39 | ::std::result::Result::Err(self)
|
47 40 | }
|
48 41 | }
|
49 42 | /// Returns true if this is a [`Event`](crate::model::CapturePokemonEvents::Event).
|
50 43 | pub fn is_event(&self) -> bool {
|
51 44 | self.as_event().is_ok()
|
52 45 | }
|
53 46 | }
|
54 47 |
|
48 + | #[allow(missing_docs)] // documentation missing in model
|
49 + | #[derive(
|
50 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
51 + | )]
|
52 + | pub struct CapturingEvent {
|
53 + | #[allow(missing_docs)] // documentation missing in model
|
54 + | pub payload: ::std::option::Option<crate::model::CapturingPayload>,
|
55 + | }
|
56 + | impl CapturingEvent {
|
57 + | #[allow(missing_docs)] // documentation missing in model
|
58 + | pub fn payload(&self) -> ::std::option::Option<&crate::model::CapturingPayload> {
|
59 + | self.payload.as_ref()
|
60 + | }
|
61 + | }
|
62 + | impl CapturingEvent {
|
63 + | /// Creates a new builder-style object to manufacture [`CapturingEvent`](crate::model::CapturingEvent).
|
64 + | pub fn builder() -> crate::model::capturing_event::Builder {
|
65 + | crate::model::capturing_event::Builder::default()
|
66 + | }
|
67 + | }
|
68 + | impl crate::constrained::Constrained for crate::model::CapturingEvent {
|
69 + | type Unconstrained = crate::model::capturing_event::Builder;
|
70 + | }
|
71 + |
|
55 72 | #[allow(missing_docs)] // documentation missing in model
|
56 73 | #[derive(
|
57 74 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
58 75 | )]
|
59 76 | pub struct CaptureEvent {
|
60 77 | #[allow(missing_docs)] // documentation missing in model
|
61 78 | pub name: ::std::option::Option<::std::string::String>,
|
62 79 | #[allow(missing_docs)] // documentation missing in model
|
63 80 | pub captured: ::std::option::Option<bool>,
|
64 81 | #[allow(missing_docs)] // documentation missing in model
|
65 82 | pub shiny: ::std::option::Option<bool>,
|
66 83 | #[allow(missing_docs)] // documentation missing in model
|
67 84 | pub pokedex_update: ::std::option::Option<::aws_smithy_types::Blob>,
|
68 85 | }
|
69 86 | impl CaptureEvent {
|
70 87 | #[allow(missing_docs)] // documentation missing in model
|
71 88 | pub fn name(&self) -> ::std::option::Option<&str> {
|
72 89 | self.name.as_deref()
|
73 90 | }
|
74 91 | #[allow(missing_docs)] // documentation missing in model
|
75 92 | pub fn captured(&self) -> ::std::option::Option<bool> {
|
76 93 | self.captured
|
77 94 | }
|
78 95 | #[allow(missing_docs)] // documentation missing in model
|
79 96 | pub fn shiny(&self) -> ::std::option::Option<bool> {
|
80 97 | self.shiny
|
81 98 | }
|
82 99 | #[allow(missing_docs)] // documentation missing in model
|
83 100 | pub fn pokedex_update(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
|
84 101 | self.pokedex_update.as_ref()
|
85 102 | }
|
86 103 | }
|
87 104 | impl CaptureEvent {
|
88 105 | /// Creates a new builder-style object to manufacture [`CaptureEvent`](crate::model::CaptureEvent).
|
89 106 | pub fn builder() -> crate::model::capture_event::Builder {
|
90 107 | crate::model::capture_event::Builder::default()
|
91 108 | }
|
92 109 | }
|
93 110 |
|
94 - | #[allow(missing_docs)] // documentation missing in model
|
95 - | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
96 - | pub enum AttemptCapturingPokemonEvent {
|
97 - | #[allow(missing_docs)] // documentation missing in model
|
98 - | Event(crate::model::CapturingEvent),
|
99 - | }
|
100 - | impl AttemptCapturingPokemonEvent {
|
101 - | #[allow(irrefutable_let_patterns)]
|
102 - | /// Tries to convert the enum instance into [`Event`](crate::model::AttemptCapturingPokemonEvent::Event), extracting the inner [`CapturingEvent`](crate::model::CapturingEvent).
|
103 - | /// Returns `Err(&Self)` if it can't be converted.
|
104 - | pub fn as_event(&self) -> ::std::result::Result<&crate::model::CapturingEvent, &Self> {
|
105 - | if let AttemptCapturingPokemonEvent::Event(val) = &self {
|
106 - | ::std::result::Result::Ok(val)
|
107 - | } else {
|
108 - | ::std::result::Result::Err(self)
|
109 - | }
|
110 - | }
|
111 - | /// Returns true if this is a [`Event`](crate::model::AttemptCapturingPokemonEvent::Event).
|
112 - | pub fn is_event(&self) -> bool {
|
113 - | self.as_event().is_ok()
|
114 - | }
|
115 - | }
|
116 - |
|
117 - | #[allow(missing_docs)] // documentation missing in model
|
111 + | /// Describes one specific validation failure for an input member.
|
118 112 | #[derive(
|
119 113 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
120 114 | )]
|
121 - | pub struct CapturingEvent {
|
122 - | #[allow(missing_docs)] // documentation missing in model
|
123 - | pub payload: ::std::option::Option<crate::model::CapturingPayload>,
|
115 + | pub struct ValidationExceptionField {
|
116 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
117 + | pub path: ::std::string::String,
|
118 + | /// A detailed description of the validation failure.
|
119 + | pub message: ::std::string::String,
|
124 120 | }
|
125 - | impl CapturingEvent {
|
126 - | #[allow(missing_docs)] // documentation missing in model
|
127 - | pub fn payload(&self) -> ::std::option::Option<&crate::model::CapturingPayload> {
|
128 - | self.payload.as_ref()
|
121 + | impl ValidationExceptionField {
|
122 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
123 + | pub fn path(&self) -> &str {
|
124 + | use std::ops::Deref;
|
125 + | self.path.deref()
|
129 126 | }
|
130 - | }
|
131 - | impl CapturingEvent {
|
132 - | /// Creates a new builder-style object to manufacture [`CapturingEvent`](crate::model::CapturingEvent).
|
133 - | pub fn builder() -> crate::model::capturing_event::Builder {
|
134 - | crate::model::capturing_event::Builder::default()
|
127 + | /// A detailed description of the validation failure.
|
128 + | pub fn message(&self) -> &str {
|
129 + | use std::ops::Deref;
|
130 + | self.message.deref()
|
135 131 | }
|
136 132 | }
|
137 - | impl crate::constrained::Constrained for crate::model::CapturingEvent {
|
138 - | type Unconstrained = crate::model::capturing_event::Builder;
|
133 + | impl ValidationExceptionField {
|
134 + | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
135 + | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
136 + | crate::model::validation_exception_field::Builder::default()
|
137 + | }
|
139 138 | }
|
140 139 |
|
141 140 | #[allow(missing_docs)] // documentation missing in model
|
142 141 | #[derive(
|
143 142 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
144 143 | )]
|
145 144 | pub struct CapturingPayload {
|
146 145 | #[allow(missing_docs)] // documentation missing in model
|
147 146 | pub name: ::std::option::Option<::std::string::String>,
|
148 147 | #[allow(missing_docs)] // documentation missing in model
|
149 148 | pub pokeball: ::std::option::Option<::std::string::String>,
|
150 149 | }
|
151 150 | impl CapturingPayload {
|
152 151 | #[allow(missing_docs)] // documentation missing in model
|
153 152 | pub fn name(&self) -> ::std::option::Option<&str> {
|
154 153 | self.name.as_deref()
|
155 154 | }
|
156 155 | #[allow(missing_docs)] // documentation missing in model
|
157 156 | pub fn pokeball(&self) -> ::std::option::Option<&str> {
|
158 157 | self.pokeball.as_deref()
|
159 158 | }
|
160 159 | }
|
161 160 | impl CapturingPayload {
|
162 161 | /// Creates a new builder-style object to manufacture [`CapturingPayload`](crate::model::CapturingPayload).
|
163 162 | pub fn builder() -> crate::model::capturing_payload::Builder {
|
164 163 | crate::model::capturing_payload::Builder::default()
|
165 164 | }
|
166 165 | }
|
167 166 | impl crate::constrained::Constrained for crate::model::CapturingPayload {
|
168 167 | type Unconstrained = crate::model::capturing_payload::Builder;
|
169 168 | }
|
170 - | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
171 - | pub mod validation_exception_field {
|
172 - |
|
173 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
174 - | /// Holds one variant for each of the ways the builder can fail.
|
175 - | #[non_exhaustive]
|
176 - | #[allow(clippy::enum_variant_names)]
|
177 - | pub enum ConstraintViolation {
|
178 - | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
179 - | MissingPath,
|
180 - | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
181 - | MissingMessage,
|
182 - | }
|
183 - | impl ::std::fmt::Display for ConstraintViolation {
|
184 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
185 - | match self {
|
186 - | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
187 - | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
188 - | }
|
189 - | }
|
190 - | }
|
191 - | impl ::std::error::Error for ConstraintViolation {}
|
192 - | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
193 - | type Error = ConstraintViolation;
|
169 + | /// See [`CapturingEvent`](crate::model::CapturingEvent).
|
170 + | pub mod capturing_event {
|
194 171 |
|
195 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
172 + | impl ::std::convert::From<Builder> for crate::model::CapturingEvent {
|
173 + | fn from(builder: Builder) -> Self {
|
196 174 | builder.build()
|
197 175 | }
|
198 176 | }
|
199 - | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
177 + | /// A builder for [`CapturingEvent`](crate::model::CapturingEvent).
|
200 178 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
201 179 | pub struct Builder {
|
202 - | pub(crate) path: ::std::option::Option<::std::string::String>,
|
203 - | pub(crate) message: ::std::option::Option<::std::string::String>,
|
180 + | pub(crate) payload: ::std::option::Option<crate::model::CapturingPayload>,
|
204 181 | }
|
205 182 | impl Builder {
|
206 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
207 - | pub fn path(mut self, input: ::std::string::String) -> Self {
|
208 - | self.path = Some(input);
|
183 + | #[allow(missing_docs)] // documentation missing in model
|
184 + | pub fn payload(
|
185 + | mut self,
|
186 + | input: ::std::option::Option<crate::model::CapturingPayload>,
|
187 + | ) -> Self {
|
188 + | self.payload = input;
|
209 189 | self
|
210 190 | }
|
211 - | /// A detailed description of the validation failure.
|
212 - | pub fn message(mut self, input: ::std::string::String) -> Self {
|
213 - | self.message = Some(input);
|
191 + | #[allow(missing_docs)] // documentation missing in model
|
192 + | pub(crate) fn set_payload(
|
193 + | mut self,
|
194 + | input: Option<impl ::std::convert::Into<crate::model::CapturingPayload>>,
|
195 + | ) -> Self {
|
196 + | self.payload = input.map(|v| v.into());
|
214 197 | self
|
215 198 | }
|
216 - | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
217 - | ///
|
218 - | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
219 - | ///
|
220 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
221 - | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
199 + | /// Consumes the builder and constructs a [`CapturingEvent`](crate::model::CapturingEvent).
|
200 + | pub fn build(self) -> crate::model::CapturingEvent {
|
222 201 | self.build_enforcing_all_constraints()
|
223 202 | }
|
224 - | fn build_enforcing_all_constraints(
|
225 - | self,
|
226 - | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
227 - | Ok(crate::model::ValidationExceptionField {
|
228 - | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
229 - | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
230 - | })
|
203 + | fn build_enforcing_all_constraints(self) -> crate::model::CapturingEvent {
|
204 + | crate::model::CapturingEvent {
|
205 + | payload: self.payload,
|
206 + | }
|
231 207 | }
|
232 208 | }
|
233 209 | }
|
234 210 | /// See [`CaptureEvent`](crate::model::CaptureEvent).
|
235 211 | pub mod capture_event {
|
236 212 |
|
237 213 | impl ::std::convert::From<Builder> for crate::model::CaptureEvent {
|
238 214 | fn from(builder: Builder) -> Self {
|
239 215 | builder.build()
|
240 216 | }
|
241 217 | }
|
242 218 | /// A builder for [`CaptureEvent`](crate::model::CaptureEvent).
|
243 219 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
244 220 | pub struct Builder {
|
245 221 | pub(crate) name: ::std::option::Option<::std::string::String>,
|
246 222 | pub(crate) captured: ::std::option::Option<bool>,
|
247 223 | pub(crate) shiny: ::std::option::Option<bool>,
|
248 224 | pub(crate) pokedex_update: ::std::option::Option<::aws_smithy_types::Blob>,
|
249 225 | }
|
250 226 | impl Builder {
|
251 227 | #[allow(missing_docs)] // documentation missing in model
|
252 228 | pub fn name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
253 229 | self.name = input;
|
254 230 | self
|
255 231 | }
|
256 232 | #[allow(missing_docs)] // documentation missing in model
|
257 233 | pub fn captured(mut self, input: ::std::option::Option<bool>) -> Self {
|
258 234 | self.captured = input;
|
259 235 | self
|
260 236 | }
|
261 237 | #[allow(missing_docs)] // documentation missing in model
|
262 238 | pub fn shiny(mut self, input: ::std::option::Option<bool>) -> Self {
|
263 239 | self.shiny = input;
|
264 240 | self
|
265 241 | }
|
266 242 | #[allow(missing_docs)] // documentation missing in model
|
267 243 | pub fn pokedex_update(
|
268 244 | mut self,
|
269 245 | input: ::std::option::Option<::aws_smithy_types::Blob>,
|
270 246 | ) -> Self {
|
271 247 | self.pokedex_update = input;
|
272 248 | self
|
273 249 | }
|
274 250 | /// Consumes the builder and constructs a [`CaptureEvent`](crate::model::CaptureEvent).
|
275 251 | pub fn build(self) -> crate::model::CaptureEvent {
|
276 252 | self.build_enforcing_all_constraints()
|
277 253 | }
|
278 254 | fn build_enforcing_all_constraints(self) -> crate::model::CaptureEvent {
|
279 255 | crate::model::CaptureEvent {
|
280 256 | name: self.name,
|
281 257 | captured: self.captured,
|
282 258 | shiny: self.shiny,
|
283 259 | pokedex_update: self.pokedex_update,
|
284 260 | }
|
285 261 | }
|
286 262 | }
|
287 263 | }
|
288 - | /// See [`CapturingEvent`](crate::model::CapturingEvent).
|
289 - | pub mod capturing_event {
|
264 + | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
265 + | pub mod validation_exception_field {
|
290 266 |
|
291 - | impl ::std::convert::From<Builder> for crate::model::CapturingEvent {
|
292 - | fn from(builder: Builder) -> Self {
|
267 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
268 + | /// Holds one variant for each of the ways the builder can fail.
|
269 + | #[non_exhaustive]
|
270 + | #[allow(clippy::enum_variant_names)]
|
271 + | pub enum ConstraintViolation {
|
272 + | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
273 + | MissingPath,
|
274 + | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
275 + | MissingMessage,
|
276 + | }
|
277 + | impl ::std::fmt::Display for ConstraintViolation {
|
278 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
279 + | match self {
|
280 + | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
281 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
282 + | }
|
283 + | }
|
284 + | }
|
285 + | impl ::std::error::Error for ConstraintViolation {}
|
286 + | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
287 + | type Error = ConstraintViolation;
|
288 + |
|
289 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
293 290 | builder.build()
|
294 291 | }
|
295 292 | }
|
296 - | /// A builder for [`CapturingEvent`](crate::model::CapturingEvent).
|
293 + | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
297 294 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
298 295 | pub struct Builder {
|
299 - | pub(crate) payload: ::std::option::Option<crate::model::CapturingPayload>,
|
296 + | pub(crate) path: ::std::option::Option<::std::string::String>,
|
297 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
300 298 | }
|
301 299 | impl Builder {
|
302 - | #[allow(missing_docs)] // documentation missing in model
|
303 - | pub fn payload(
|
304 - | mut self,
|
305 - | input: ::std::option::Option<crate::model::CapturingPayload>,
|
306 - | ) -> Self {
|
307 - | self.payload = input;
|
300 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
301 + | pub fn path(mut self, input: ::std::string::String) -> Self {
|
302 + | self.path = Some(input);
|
308 303 | self
|
309 304 | }
|
310 - | #[allow(missing_docs)] // documentation missing in model
|
311 - | pub(crate) fn set_payload(
|
312 - | mut self,
|
313 - | input: Option<impl ::std::convert::Into<crate::model::CapturingPayload>>,
|
314 - | ) -> Self {
|
315 - | self.payload = input.map(|v| v.into());
|
305 + | /// A detailed description of the validation failure.
|
306 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
307 + | self.message = Some(input);
|
316 308 | self
|
317 309 | }
|
318 - | /// Consumes the builder and constructs a [`CapturingEvent`](crate::model::CapturingEvent).
|
319 - | pub fn build(self) -> crate::model::CapturingEvent {
|
310 + | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
311 + | ///
|
312 + | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
313 + | ///
|
314 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
315 + | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
320 316 | self.build_enforcing_all_constraints()
|
321 317 | }
|
322 - | fn build_enforcing_all_constraints(self) -> crate::model::CapturingEvent {
|
323 - | crate::model::CapturingEvent {
|
324 - | payload: self.payload,
|
325 - | }
|
318 + | fn build_enforcing_all_constraints(
|
319 + | self,
|
320 + | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
321 + | Ok(crate::model::ValidationExceptionField {
|
322 + | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
323 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
324 + | })
|
326 325 | }
|
327 326 | }
|
328 327 | }
|
329 328 | /// See [`CapturingPayload`](crate::model::CapturingPayload).
|
330 329 | pub mod capturing_payload {
|
331 330 |
|
332 331 | impl ::std::convert::From<Builder> for crate::model::CapturingPayload {
|
333 332 | fn from(builder: Builder) -> Self {
|
334 333 | builder.build()
|
335 334 | }
|