1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /// The service builder for [`PokemonService`].
|
3 + | ///
|
4 + | /// Constructed via [`PokemonService::builder`].
|
5 + | pub struct PokemonServiceBuilder<Body, L, HttpPl, ModelPl> {
|
6 + | capture_pokemon: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
7 + | check_health: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
8 + | do_nothing: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
9 + | get_server_statistics: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
10 + | layer: L,
|
11 + | http_plugin: HttpPl,
|
12 + | model_plugin: ModelPl,
|
13 + | }
|
14 + |
|
15 + | impl<Body, L, HttpPl, ModelPl> PokemonServiceBuilder<Body, L, HttpPl, ModelPl> {
|
16 + | /// Sets the [`CapturePokemon`](crate::operation_shape::CapturePokemon) operation.
|
17 + | ///
|
18 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
19 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
20 + | ///
|
21 + | /// # Example
|
22 + | ///
|
23 + | /// ```no_run
|
24 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
25 + | ///
|
26 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
27 + | ///
|
28 + | /// async fn handler(input: input::CapturePokemonInput) -> Result<output::CapturePokemonOutput, error::CapturePokemonError> {
|
29 + | /// todo!()
|
30 + | /// }
|
31 + | ///
|
32 + | /// let config = PokemonServiceConfig::builder().build();
|
33 + | /// let app = PokemonService::builder(config)
|
34 + | /// .capture_pokemon(handler)
|
35 + | /// /* Set other handlers */
|
36 + | /// .build()
|
37 + | /// .unwrap();
|
38 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
39 + | /// ```
|
40 + | ///
|
41 + | pub fn capture_pokemon<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
42 + | where
|
43 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::CapturePokemon, HandlerExtractors>,
|
44 + |
|
45 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
46 + | PokemonService<L>,
|
47 + | crate::operation_shape::CapturePokemon,
|
48 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::CapturePokemon, HandlerType>
|
49 + | >,
|
50 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
51 + | PokemonService<L>,
|
52 + | crate::operation_shape::CapturePokemon,
|
53 + | ModelPl::Output
|
54 + | >,
|
55 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
56 + | PokemonService<L>,
|
57 + | crate::operation_shape::CapturePokemon,
|
58 + | <
|
59 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
60 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
61 + | PokemonService<L>,
|
62 + | crate::operation_shape::CapturePokemon,
|
63 + | ModelPl::Output
|
64 + | >
|
65 + | >::Output
|
66 + | >,
|
67 + |
|
68 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
69 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
70 + |
|
71 + | {
|
72 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
73 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
74 + | let svc = crate::operation_shape::CapturePokemon::from_handler(handler);
|
75 + | let svc = self.model_plugin.apply(svc);
|
76 + | let svc =
|
77 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
78 + | .apply(svc);
|
79 + | let svc = self.http_plugin.apply(svc);
|
80 + | self.capture_pokemon_custom(svc)
|
81 + | }
|
82 + |
|
83 + | /// Sets the [`CapturePokemon`](crate::operation_shape::CapturePokemon) operation.
|
84 + | ///
|
85 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
86 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
87 + | ///
|
88 + | /// # Example
|
89 + | ///
|
90 + | /// ```no_run
|
91 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
92 + | ///
|
93 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
94 + | ///
|
95 + | /// async fn handler(input: input::CapturePokemonInput) -> Result<output::CapturePokemonOutput, error::CapturePokemonError> {
|
96 + | /// todo!()
|
97 + | /// }
|
98 + | ///
|
99 + | /// let config = PokemonServiceConfig::builder().build();
|
100 + | /// let svc = ::tower::util::service_fn(handler);
|
101 + | /// let app = PokemonService::builder(config)
|
102 + | /// .capture_pokemon_service(svc)
|
103 + | /// /* Set other handlers */
|
104 + | /// .build()
|
105 + | /// .unwrap();
|
106 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
107 + | /// ```
|
108 + | ///
|
109 + | pub fn capture_pokemon_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
110 + | where
|
111 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::CapturePokemon, ServiceExtractors>,
|
112 + |
|
113 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
114 + | PokemonService<L>,
|
115 + | crate::operation_shape::CapturePokemon,
|
116 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::CapturePokemon, S>
|
117 + | >,
|
118 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
119 + | PokemonService<L>,
|
120 + | crate::operation_shape::CapturePokemon,
|
121 + | ModelPl::Output
|
122 + | >,
|
123 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
124 + | PokemonService<L>,
|
125 + | crate::operation_shape::CapturePokemon,
|
126 + | <
|
127 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
128 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
129 + | PokemonService<L>,
|
130 + | crate::operation_shape::CapturePokemon,
|
131 + | ModelPl::Output
|
132 + | >
|
133 + | >::Output
|
134 + | >,
|
135 + |
|
136 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
137 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
138 + |
|
139 + | {
|
140 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
141 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
142 + | let svc = crate::operation_shape::CapturePokemon::from_service(service);
|
143 + | let svc = self.model_plugin.apply(svc);
|
144 + | let svc =
|
145 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
146 + | .apply(svc);
|
147 + | let svc = self.http_plugin.apply(svc);
|
148 + | self.capture_pokemon_custom(svc)
|
149 + | }
|
150 + |
|
151 + | /// Sets the [`CapturePokemon`](crate::operation_shape::CapturePokemon) to a custom [`Service`](tower::Service).
|
152 + | /// not constrained by the Smithy contract.
|
153 + | fn capture_pokemon_custom<S>(mut self, svc: S) -> Self
|
154 + | where
|
155 + | S: ::tower::Service<
|
156 + | ::http::Request<Body>,
|
157 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
158 + | Error = ::std::convert::Infallible,
|
159 + | > + Clone
|
160 + | + Send
|
161 + | + 'static,
|
162 + | S::Future: Send + 'static,
|
163 + | {
|
164 + | self.capture_pokemon = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
165 + | self
|
166 + | }
|
167 + |
|
168 + | /// Sets the [`CheckHealth`](crate::operation_shape::CheckHealth) operation.
|
169 + | ///
|
170 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
171 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
172 + | ///
|
173 + | /// # Example
|
174 + | ///
|
175 + | /// ```no_run
|
176 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
177 + | ///
|
178 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
179 + | ///
|
180 + | /// async fn handler(input: input::CheckHealthInput) -> output::CheckHealthOutput {
|
181 + | /// todo!()
|
182 + | /// }
|
183 + | ///
|
184 + | /// let config = PokemonServiceConfig::builder().build();
|
185 + | /// let app = PokemonService::builder(config)
|
186 + | /// .check_health(handler)
|
187 + | /// /* Set other handlers */
|
188 + | /// .build()
|
189 + | /// .unwrap();
|
190 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
191 + | /// ```
|
192 + | ///
|
193 + | pub fn check_health<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
194 + | where
|
195 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::CheckHealth, HandlerExtractors>,
|
196 + |
|
197 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
198 + | PokemonService<L>,
|
199 + | crate::operation_shape::CheckHealth,
|
200 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::CheckHealth, HandlerType>
|
201 + | >,
|
202 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
203 + | PokemonService<L>,
|
204 + | crate::operation_shape::CheckHealth,
|
205 + | ModelPl::Output
|
206 + | >,
|
207 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
208 + | PokemonService<L>,
|
209 + | crate::operation_shape::CheckHealth,
|
210 + | <
|
211 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
212 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
213 + | PokemonService<L>,
|
214 + | crate::operation_shape::CheckHealth,
|
215 + | ModelPl::Output
|
216 + | >
|
217 + | >::Output
|
218 + | >,
|
219 + |
|
220 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
221 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
222 + |
|
223 + | {
|
224 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
225 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
226 + | let svc = crate::operation_shape::CheckHealth::from_handler(handler);
|
227 + | let svc = self.model_plugin.apply(svc);
|
228 + | let svc =
|
229 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
230 + | .apply(svc);
|
231 + | let svc = self.http_plugin.apply(svc);
|
232 + | self.check_health_custom(svc)
|
233 + | }
|
234 + |
|
235 + | /// Sets the [`CheckHealth`](crate::operation_shape::CheckHealth) operation.
|
236 + | ///
|
237 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
238 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
239 + | ///
|
240 + | /// # Example
|
241 + | ///
|
242 + | /// ```no_run
|
243 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
244 + | ///
|
245 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
246 + | ///
|
247 + | /// async fn handler(input: input::CheckHealthInput) -> Result<output::CheckHealthOutput, std::convert::Infallible> {
|
248 + | /// todo!()
|
249 + | /// }
|
250 + | ///
|
251 + | /// let config = PokemonServiceConfig::builder().build();
|
252 + | /// let svc = ::tower::util::service_fn(handler);
|
253 + | /// let app = PokemonService::builder(config)
|
254 + | /// .check_health_service(svc)
|
255 + | /// /* Set other handlers */
|
256 + | /// .build()
|
257 + | /// .unwrap();
|
258 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
259 + | /// ```
|
260 + | ///
|
261 + | pub fn check_health_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
262 + | where
|
263 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::CheckHealth, ServiceExtractors>,
|
264 + |
|
265 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
266 + | PokemonService<L>,
|
267 + | crate::operation_shape::CheckHealth,
|
268 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::CheckHealth, S>
|
269 + | >,
|
270 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
271 + | PokemonService<L>,
|
272 + | crate::operation_shape::CheckHealth,
|
273 + | ModelPl::Output
|
274 + | >,
|
275 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
276 + | PokemonService<L>,
|
277 + | crate::operation_shape::CheckHealth,
|
278 + | <
|
279 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
280 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
281 + | PokemonService<L>,
|
282 + | crate::operation_shape::CheckHealth,
|
283 + | ModelPl::Output
|
284 + | >
|
285 + | >::Output
|
286 + | >,
|
287 + |
|
288 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
289 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
290 + |
|
291 + | {
|
292 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
293 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
294 + | let svc = crate::operation_shape::CheckHealth::from_service(service);
|
295 + | let svc = self.model_plugin.apply(svc);
|
296 + | let svc =
|
297 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
298 + | .apply(svc);
|
299 + | let svc = self.http_plugin.apply(svc);
|
300 + | self.check_health_custom(svc)
|
301 + | }
|
302 + |
|
303 + | /// Sets the [`CheckHealth`](crate::operation_shape::CheckHealth) to a custom [`Service`](tower::Service).
|
304 + | /// not constrained by the Smithy contract.
|
305 + | fn check_health_custom<S>(mut self, svc: S) -> Self
|
306 + | where
|
307 + | S: ::tower::Service<
|
308 + | ::http::Request<Body>,
|
309 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
310 + | Error = ::std::convert::Infallible,
|
311 + | > + Clone
|
312 + | + Send
|
313 + | + 'static,
|
314 + | S::Future: Send + 'static,
|
315 + | {
|
316 + | self.check_health = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
317 + | self
|
318 + | }
|
319 + |
|
320 + | /// Sets the [`DoNothing`](crate::operation_shape::DoNothing) operation.
|
321 + | ///
|
322 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
323 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
324 + | ///
|
325 + | /// # Example
|
326 + | ///
|
327 + | /// ```no_run
|
328 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
329 + | ///
|
330 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
331 + | ///
|
332 + | /// async fn handler(input: input::DoNothingInput) -> output::DoNothingOutput {
|
333 + | /// todo!()
|
334 + | /// }
|
335 + | ///
|
336 + | /// let config = PokemonServiceConfig::builder().build();
|
337 + | /// let app = PokemonService::builder(config)
|
338 + | /// .do_nothing(handler)
|
339 + | /// /* Set other handlers */
|
340 + | /// .build()
|
341 + | /// .unwrap();
|
342 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
343 + | /// ```
|
344 + | ///
|
345 + | pub fn do_nothing<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
346 + | where
|
347 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::DoNothing, HandlerExtractors>,
|
348 + |
|
349 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
350 + | PokemonService<L>,
|
351 + | crate::operation_shape::DoNothing,
|
352 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::DoNothing, HandlerType>
|
353 + | >,
|
354 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
355 + | PokemonService<L>,
|
356 + | crate::operation_shape::DoNothing,
|
357 + | ModelPl::Output
|
358 + | >,
|
359 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
360 + | PokemonService<L>,
|
361 + | crate::operation_shape::DoNothing,
|
362 + | <
|
363 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
364 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
365 + | PokemonService<L>,
|
366 + | crate::operation_shape::DoNothing,
|
367 + | ModelPl::Output
|
368 + | >
|
369 + | >::Output
|
370 + | >,
|
371 + |
|
372 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
373 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
374 + |
|
375 + | {
|
376 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
377 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
378 + | let svc = crate::operation_shape::DoNothing::from_handler(handler);
|
379 + | let svc = self.model_plugin.apply(svc);
|
380 + | let svc =
|
381 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
382 + | .apply(svc);
|
383 + | let svc = self.http_plugin.apply(svc);
|
384 + | self.do_nothing_custom(svc)
|
385 + | }
|
386 + |
|
387 + | /// Sets the [`DoNothing`](crate::operation_shape::DoNothing) operation.
|
388 + | ///
|
389 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
390 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
391 + | ///
|
392 + | /// # Example
|
393 + | ///
|
394 + | /// ```no_run
|
395 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
396 + | ///
|
397 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
398 + | ///
|
399 + | /// async fn handler(input: input::DoNothingInput) -> Result<output::DoNothingOutput, std::convert::Infallible> {
|
400 + | /// todo!()
|
401 + | /// }
|
402 + | ///
|
403 + | /// let config = PokemonServiceConfig::builder().build();
|
404 + | /// let svc = ::tower::util::service_fn(handler);
|
405 + | /// let app = PokemonService::builder(config)
|
406 + | /// .do_nothing_service(svc)
|
407 + | /// /* Set other handlers */
|
408 + | /// .build()
|
409 + | /// .unwrap();
|
410 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
411 + | /// ```
|
412 + | ///
|
413 + | pub fn do_nothing_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
414 + | where
|
415 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::DoNothing, ServiceExtractors>,
|
416 + |
|
417 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
418 + | PokemonService<L>,
|
419 + | crate::operation_shape::DoNothing,
|
420 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::DoNothing, S>
|
421 + | >,
|
422 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
423 + | PokemonService<L>,
|
424 + | crate::operation_shape::DoNothing,
|
425 + | ModelPl::Output
|
426 + | >,
|
427 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
428 + | PokemonService<L>,
|
429 + | crate::operation_shape::DoNothing,
|
430 + | <
|
431 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
432 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
433 + | PokemonService<L>,
|
434 + | crate::operation_shape::DoNothing,
|
435 + | ModelPl::Output
|
436 + | >
|
437 + | >::Output
|
438 + | >,
|
439 + |
|
440 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
441 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
442 + |
|
443 + | {
|
444 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
445 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
446 + | let svc = crate::operation_shape::DoNothing::from_service(service);
|
447 + | let svc = self.model_plugin.apply(svc);
|
448 + | let svc =
|
449 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
450 + | .apply(svc);
|
451 + | let svc = self.http_plugin.apply(svc);
|
452 + | self.do_nothing_custom(svc)
|
453 + | }
|
454 + |
|
455 + | /// Sets the [`DoNothing`](crate::operation_shape::DoNothing) to a custom [`Service`](tower::Service).
|
456 + | /// not constrained by the Smithy contract.
|
457 + | fn do_nothing_custom<S>(mut self, svc: S) -> Self
|
458 + | where
|
459 + | S: ::tower::Service<
|
460 + | ::http::Request<Body>,
|
461 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
462 + | Error = ::std::convert::Infallible,
|
463 + | > + Clone
|
464 + | + Send
|
465 + | + 'static,
|
466 + | S::Future: Send + 'static,
|
467 + | {
|
468 + | self.do_nothing = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
469 + | self
|
470 + | }
|
471 + |
|
472 + | /// Sets the [`GetServerStatistics`](crate::operation_shape::GetServerStatistics) operation.
|
473 + | ///
|
474 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
475 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
476 + | ///
|
477 + | /// # Example
|
478 + | ///
|
479 + | /// ```no_run
|
480 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
481 + | ///
|
482 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
483 + | ///
|
484 + | /// async fn handler(input: input::GetServerStatisticsInput) -> output::GetServerStatisticsOutput {
|
485 + | /// todo!()
|
486 + | /// }
|
487 + | ///
|
488 + | /// let config = PokemonServiceConfig::builder().build();
|
489 + | /// let app = PokemonService::builder(config)
|
490 + | /// .get_server_statistics(handler)
|
491 + | /// /* Set other handlers */
|
492 + | /// .build()
|
493 + | /// .unwrap();
|
494 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
495 + | /// ```
|
496 + | ///
|
497 + | pub fn get_server_statistics<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
498 + | where
|
499 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::GetServerStatistics, HandlerExtractors>,
|
500 + |
|
501 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
502 + | PokemonService<L>,
|
503 + | crate::operation_shape::GetServerStatistics,
|
504 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::GetServerStatistics, HandlerType>
|
505 + | >,
|
506 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
507 + | PokemonService<L>,
|
508 + | crate::operation_shape::GetServerStatistics,
|
509 + | ModelPl::Output
|
510 + | >,
|
511 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
512 + | PokemonService<L>,
|
513 + | crate::operation_shape::GetServerStatistics,
|
514 + | <
|
515 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
516 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
517 + | PokemonService<L>,
|
518 + | crate::operation_shape::GetServerStatistics,
|
519 + | ModelPl::Output
|
520 + | >
|
521 + | >::Output
|
522 + | >,
|
523 + |
|
524 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
525 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
526 + |
|
527 + | {
|
528 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
529 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
530 + | let svc = crate::operation_shape::GetServerStatistics::from_handler(handler);
|
531 + | let svc = self.model_plugin.apply(svc);
|
532 + | let svc =
|
533 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
534 + | .apply(svc);
|
535 + | let svc = self.http_plugin.apply(svc);
|
536 + | self.get_server_statistics_custom(svc)
|
537 + | }
|
538 + |
|
539 + | /// Sets the [`GetServerStatistics`](crate::operation_shape::GetServerStatistics) operation.
|
540 + | ///
|
541 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
542 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
543 + | ///
|
544 + | /// # Example
|
545 + | ///
|
546 + | /// ```no_run
|
547 + | /// use pokemon_service_awsjson_server_sdk_http0x::{PokemonService, PokemonServiceConfig};
|
548 + | ///
|
549 + | /// use pokemon_service_awsjson_server_sdk_http0x::{input, output, error};
|
550 + | ///
|
551 + | /// async fn handler(input: input::GetServerStatisticsInput) -> Result<output::GetServerStatisticsOutput, std::convert::Infallible> {
|
552 + | /// todo!()
|
553 + | /// }
|
554 + | ///
|
555 + | /// let config = PokemonServiceConfig::builder().build();
|
556 + | /// let svc = ::tower::util::service_fn(handler);
|
557 + | /// let app = PokemonService::builder(config)
|
558 + | /// .get_server_statistics_service(svc)
|
559 + | /// /* Set other handlers */
|
560 + | /// .build()
|
561 + | /// .unwrap();
|
562 + | /// # let app: PokemonService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
|
563 + | /// ```
|
564 + | ///
|
565 + | pub fn get_server_statistics_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
566 + | where
|
567 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::GetServerStatistics, ServiceExtractors>,
|
568 + |
|
569 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
570 + | PokemonService<L>,
|
571 + | crate::operation_shape::GetServerStatistics,
|
572 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::GetServerStatistics, S>
|
573 + | >,
|
574 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
575 + | PokemonService<L>,
|
576 + | crate::operation_shape::GetServerStatistics,
|
577 + | ModelPl::Output
|
578 + | >,
|
579 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
580 + | PokemonService<L>,
|
581 + | crate::operation_shape::GetServerStatistics,
|
582 + | <
|
583 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
584 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
585 + | PokemonService<L>,
|
586 + | crate::operation_shape::GetServerStatistics,
|
587 + | ModelPl::Output
|
588 + | >
|
589 + | >::Output
|
590 + | >,
|
591 + |
|
592 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
593 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
594 + |
|
595 + | {
|
596 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
597 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
598 + | let svc = crate::operation_shape::GetServerStatistics::from_service(service);
|
599 + | let svc = self.model_plugin.apply(svc);
|
600 + | let svc =
|
601 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
602 + | .apply(svc);
|
603 + | let svc = self.http_plugin.apply(svc);
|
604 + | self.get_server_statistics_custom(svc)
|
605 + | }
|
606 + |
|
607 + | /// Sets the [`GetServerStatistics`](crate::operation_shape::GetServerStatistics) to a custom [`Service`](tower::Service).
|
608 + | /// not constrained by the Smithy contract.
|
609 + | fn get_server_statistics_custom<S>(mut self, svc: S) -> Self
|
610 + | where
|
611 + | S: ::tower::Service<
|
612 + | ::http::Request<Body>,
|
613 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
614 + | Error = ::std::convert::Infallible,
|
615 + | > + Clone
|
616 + | + Send
|
617 + | + 'static,
|
618 + | S::Future: Send + 'static,
|
619 + | {
|
620 + | self.get_server_statistics =
|
621 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
622 + | self
|
623 + | }
|
624 + | }
|
625 + |
|
626 + | impl<Body, L, HttpPl, ModelPl> PokemonServiceBuilder<Body, L, HttpPl, ModelPl> {
|
627 + | /// Constructs a [`PokemonService`] from the arguments provided to the builder.
|
628 + | ///
|
629 + | /// Forgetting to register a handler for one or more operations will result in an error.
|
630 + | ///
|
631 + | /// Check out [`PokemonServiceBuilder::build_unchecked`] if you'd prefer the service to return status code 500 when an
|
632 + | /// unspecified route is requested.
|
633 + | pub fn build(
|
634 + | self,
|
635 + | ) -> ::std::result::Result<
|
636 + | PokemonService<
|
637 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
638 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
639 + | L::Service,
|
640 + | >,
|
641 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
642 + | >,
|
643 + | >,
|
644 + | MissingOperationsError,
|
645 + | >
|
646 + | where
|
647 + | L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
648 + | {
|
649 + | let router = {
|
650 + | use ::aws_smithy_legacy_http_server::operation::OperationShape;
|
651 + | let mut missing_operation_names = std::collections::HashMap::new();
|
652 + | if self.capture_pokemon.is_none() {
|
653 + | missing_operation_names.insert(
|
654 + | crate::operation_shape::CapturePokemon::ID,
|
655 + | ".capture_pokemon()",
|
656 + | );
|
657 + | }
|
658 + | if self.check_health.is_none() {
|
659 + | missing_operation_names
|
660 + | .insert(crate::operation_shape::CheckHealth::ID, ".check_health()");
|
661 + | }
|
662 + | if self.do_nothing.is_none() {
|
663 + | missing_operation_names
|
664 + | .insert(crate::operation_shape::DoNothing::ID, ".do_nothing()");
|
665 + | }
|
666 + | if self.get_server_statistics.is_none() {
|
667 + | missing_operation_names.insert(
|
668 + | crate::operation_shape::GetServerStatistics::ID,
|
669 + | ".get_server_statistics()",
|
670 + | );
|
671 + | }
|
672 + | if !missing_operation_names.is_empty() {
|
673 + | return Err(MissingOperationsError {
|
674 + | operation_names2setter_methods: missing_operation_names,
|
675 + | });
|
676 + | }
|
677 + | let unexpected_error_msg = "this should never panic since we are supposed to check beforehand that a handler has been registered for this operation; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues";
|
678 + |
|
679 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
|
680 + | (
|
681 + | request_specs::capture_pokemon(),
|
682 + | self.capture_pokemon.expect(unexpected_error_msg),
|
683 + | ),
|
684 + | (
|
685 + | request_specs::check_health(),
|
686 + | self.check_health.expect(unexpected_error_msg),
|
687 + | ),
|
688 + | (
|
689 + | request_specs::do_nothing(),
|
690 + | self.do_nothing.expect(unexpected_error_msg),
|
691 + | ),
|
692 + | (
|
693 + | request_specs::get_server_statistics(),
|
694 + | self.get_server_statistics.expect(unexpected_error_msg),
|
695 + | ),
|
696 + | ])
|
697 + | };
|
698 + | let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
|
699 + | let svc = svc.map(|s| s.layer(self.layer));
|
700 + | Ok(PokemonService { svc })
|
701 + | }
|
702 + |
|
703 + | /// Constructs a [`PokemonService`] from the arguments provided to the builder.
|
704 + | /// Operations without a handler default to returning 500 Internal Server Error to the caller.
|
705 + | ///
|
706 + | /// Check out [`PokemonServiceBuilder::build`] if you'd prefer the builder to fail if one or more operations do
|
707 + | /// not have a registered handler.
|
708 + | pub fn build_unchecked(self) -> PokemonService<L::Service>
|
709 + | where
|
710 + | Body: Send + 'static,
|
711 + | L: ::tower::Layer<
|
712 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
713 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
714 + | ::aws_smithy_legacy_http_server::routing::Route<Body>,
|
715 + | >,
|
716 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
717 + | >,
|
718 + | >,
|
719 + | {
|
720 + | let router =
|
721 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter(
|
722 + | [
|
723 + | (
|
724 + | request_specs::capture_pokemon(),
|
725 + | self.capture_pokemon.unwrap_or_else(|| {
|
726 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
727 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
728 + | >::default();
|
729 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
730 + | }),
|
731 + | ),
|
732 + | (
|
733 + | request_specs::check_health(),
|
734 + | self.check_health.unwrap_or_else(|| {
|
735 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
736 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
737 + | >::default();
|
738 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
739 + | }),
|
740 + | ),
|
741 + | (
|
742 + | request_specs::do_nothing(),
|
743 + | self.do_nothing.unwrap_or_else(|| {
|
744 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
745 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
746 + | >::default();
|
747 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
748 + | }),
|
749 + | ),
|
750 + | (
|
751 + | request_specs::get_server_statistics(),
|
752 + | self.get_server_statistics.unwrap_or_else(|| {
|
753 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
754 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
755 + | >::default();
|
756 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
757 + | }),
|
758 + | ),
|
759 + | ],
|
760 + | );
|
761 + | let svc = self
|
762 + | .layer
|
763 + | .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
|
764 + | PokemonService { svc }
|
765 + | }
|
766 + | }
|
767 + |
|
768 + | /// The error encountered when calling the [`PokemonServiceBuilder::build`] method if one or more operation handlers are not
|
769 + | /// specified.
|
770 + | #[derive(Debug)]
|
771 + | pub struct MissingOperationsError {
|
772 + | operation_names2setter_methods:
|
773 + | std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
|
774 + | }
|
775 + |
|
776 + | impl std::fmt::Display for MissingOperationsError {
|
777 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
778 + | write!(
|
779 + | f,
|
780 + | "You must specify a handler for all operations attached to `PokemonService`.\n\
|
781 + | We are missing handlers for the following operations:\n",
|
782 + | )?;
|
783 + | for operation_name in self.operation_names2setter_methods.keys() {
|
784 + | writeln!(f, "- {}", operation_name.absolute())?;
|
785 + | }
|
786 + |
|
787 + | writeln!(f, "\nUse the dedicated methods on `PokemonServiceBuilder` to register the missing handlers:")?;
|
788 + | for setter_name in self.operation_names2setter_methods.values() {
|
789 + | writeln!(f, "- {}", setter_name)?;
|
790 + | }
|
791 + | Ok(())
|
792 + | }
|
793 + | }
|
794 + |
|
795 + | impl std::error::Error for MissingOperationsError {}
|
796 + |
|
797 + | mod request_specs {
|
798 + | pub(super) fn capture_pokemon() -> &'static str {
|
799 + | "PokemonService.CapturePokemon"
|
800 + | }
|
801 + | pub(super) fn check_health() -> &'static str {
|
802 + | "PokemonService.CheckHealth"
|
803 + | }
|
804 + | pub(super) fn do_nothing() -> &'static str {
|
805 + | "PokemonService.DoNothing"
|
806 + | }
|
807 + | pub(super) fn get_server_statistics() -> &'static str {
|
808 + | "PokemonService.GetServerStatistics"
|
809 + | }
|
810 + | }
|
811 + |
|
812 + | /// The Pokémon Service allows you to retrieve information about Pokémon species.
|
813 + | ///
|
814 + | /// See the [root](crate) documentation for more information.
|
815 + | #[derive(Clone)]
|
816 + | pub struct PokemonService<
|
817 + | S = ::aws_smithy_legacy_http_server::routing::RoutingService<
|
818 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
819 + | ::aws_smithy_legacy_http_server::routing::Route<
|
820 + | ::aws_smithy_legacy_http_server::body::BoxBody,
|
821 + | >,
|
822 + | >,
|
823 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
824 + | >,
|
825 + | > {
|
826 + | // This is the router wrapped by layers.
|
827 + | svc: S,
|
828 + | }
|
829 + |
|
830 + | impl PokemonService<()> {
|
831 + | /// Constructs a builder for [`PokemonService`].
|
832 + | /// You must specify a configuration object holding any plugins and layers that should be applied
|
833 + | /// to the operations in this service.
|
834 + | pub fn builder<
|
835 + | Body,
|
836 + | L,
|
837 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
838 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
839 + | >(
|
840 + | config: PokemonServiceConfig<L, HttpPl, ModelPl>,
|
841 + | ) -> PokemonServiceBuilder<Body, L, HttpPl, ModelPl> {
|
842 + | PokemonServiceBuilder {
|
843 + | capture_pokemon: None,
|
844 + | check_health: None,
|
845 + | do_nothing: None,
|
846 + | get_server_statistics: None,
|
847 + | layer: config.layers,
|
848 + | http_plugin: config.http_plugins,
|
849 + | model_plugin: config.model_plugins,
|
850 + | }
|
851 + | }
|
852 + |
|
853 + | /// Constructs a builder for [`PokemonService`].
|
854 + | /// You must specify what plugins should be applied to the operations in this service.
|
855 + | ///
|
856 + | /// Use [`PokemonService::builder_without_plugins`] if you don't need to apply plugins.
|
857 + | ///
|
858 + | /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
|
859 + | /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
|
860 + | /// multiple plugins.
|
861 + | #[deprecated(
|
862 + | since = "0.57.0",
|
863 + | note = "please use the `builder` constructor and register plugins on the `PokemonServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
864 + | )]
|
865 + | pub fn builder_with_plugins<
|
866 + | Body,
|
867 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
868 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
869 + | >(
|
870 + | http_plugin: HttpPl,
|
871 + | model_plugin: ModelPl,
|
872 + | ) -> PokemonServiceBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
|
873 + | PokemonServiceBuilder {
|
874 + | capture_pokemon: None,
|
875 + | check_health: None,
|
876 + | do_nothing: None,
|
877 + | get_server_statistics: None,
|
878 + | layer: ::tower::layer::util::Identity::new(),
|
879 + | http_plugin,
|
880 + | model_plugin,
|
881 + | }
|
882 + | }
|
883 + |
|
884 + | /// Constructs a builder for [`PokemonService`].
|
885 + | ///
|
886 + | /// Use [`PokemonService::builder_with_plugins`] if you need to specify plugins.
|
887 + | #[deprecated(
|
888 + | since = "0.57.0",
|
889 + | note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
890 + | )]
|
891 + | pub fn builder_without_plugins<Body>() -> PokemonServiceBuilder<
|
892 + | Body,
|
893 + | ::tower::layer::util::Identity,
|
894 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
895 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
896 + | > {
|
897 + | Self::builder_with_plugins(
|
898 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
899 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
900 + | )
|
901 + | }
|
902 + | }
|
903 + |
|
904 + | impl<S> PokemonService<S> {
|
905 + | /// Converts [`PokemonService`] into a [`MakeService`](tower::make::MakeService).
|
906 + | pub fn into_make_service(
|
907 + | self,
|
908 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
|
909 + | ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
|
910 + | }
|
911 + |
|
912 + | /// Converts [`PokemonService`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
|
913 + | pub fn into_make_service_with_connect_info<C>(
|
914 + | self,
|
915 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
|
916 + | ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
|
917 + | }
|
918 + | }
|
919 + |
|
920 + | impl<S>
|
921 + | PokemonService<
|
922 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
923 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<S>,
|
924 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
925 + | >,
|
926 + | >
|
927 + | {
|
928 + | /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
|
929 + | #[deprecated(
|
930 + | since = "0.57.0",
|
931 + | note = "please add layers to the `PokemonServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
932 + | )]
|
933 + | pub fn layer<L>(
|
934 + | self,
|
935 + | layer: &L,
|
936 + | ) -> PokemonService<
|
937 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
938 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<L::Service>,
|
939 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
940 + | >,
|
941 + | >
|
942 + | where
|
943 + | L: ::tower::Layer<S>,
|
944 + | {
|
945 + | PokemonService {
|
946 + | svc: self.svc.map(|s| s.layer(layer)),
|
947 + | }
|
948 + | }
|
949 + |
|
950 + | /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
|
951 + | ///
|
952 + | /// This has the effect of erasing all types accumulated via layers.
|
953 + | pub fn boxed<B>(
|
954 + | self,
|
955 + | ) -> PokemonService<
|
956 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
957 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
958 + | ::aws_smithy_legacy_http_server::routing::Route<B>,
|
959 + | >,
|
960 + | ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0,
|
961 + | >,
|
962 + | >
|
963 + | where
|
964 + | S: ::tower::Service<
|
965 + | ::http::Request<B>,
|
966 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
967 + | Error = std::convert::Infallible,
|
968 + | >,
|
969 + | S: Clone + Send + 'static,
|
970 + | S::Future: Send + 'static,
|
971 + | {
|
972 + | self.layer(&::tower::layer::layer_fn(
|
973 + | ::aws_smithy_legacy_http_server::routing::Route::new,
|
974 + | ))
|
975 + | }
|
976 + | }
|
977 + |
|
978 + | impl<S, R> ::tower::Service<R> for PokemonService<S>
|
979 + | where
|
980 + | S: ::tower::Service<R>,
|
981 + | {
|
982 + | type Response = S::Response;
|
983 + | type Error = S::Error;
|
984 + | type Future = S::Future;
|
985 + |
|
986 + | fn poll_ready(
|
987 + | &mut self,
|
988 + | cx: &mut std::task::Context,
|
989 + | ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
|
990 + | self.svc.poll_ready(cx)
|
991 + | }
|
992 + |
|
993 + | fn call(&mut self, request: R) -> Self::Future {
|
994 + | self.svc.call(request)
|
995 + | }
|
996 + | }
|
997 + |
|
998 + | /// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in PokemonService.
|
999 + | #[allow(clippy::enum_variant_names)]
|
1000 + | #[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
1001 + | pub enum Operation {
|
1002 + | CapturePokemon,
|
1003 + | CheckHealth,
|
1004 + | DoNothing,
|
1005 + | GetServerStatistics,
|
1006 + | }
|
1007 + |
|
1008 + | impl Operation {
|
1009 + | /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
|
1010 + | pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
|
1011 + | match self {
|
1012 + | Operation::CapturePokemon => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1013 + | "com.aws.example#CapturePokemon",
|
1014 + | "com.aws.example",
|
1015 + | "CapturePokemon",
|
1016 + | ),
|
1017 + | Operation::CheckHealth => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1018 + | "com.aws.example#CheckHealth",
|
1019 + | "com.aws.example",
|
1020 + | "CheckHealth",
|
1021 + | ),
|
1022 + | Operation::DoNothing => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1023 + | "com.aws.example#DoNothing",
|
1024 + | "com.aws.example",
|
1025 + | "DoNothing",
|
1026 + | ),
|
1027 + | Operation::GetServerStatistics => {
|
1028 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1029 + | "com.aws.example#GetServerStatistics",
|
1030 + | "com.aws.example",
|
1031 + | "GetServerStatistics",
|
1032 + | )
|
1033 + | }
|
1034 + | }
|
1035 + | }
|
1036 + | }
|
1037 + | impl<L>
|
1038 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1039 + | crate::operation_shape::CapturePokemon,
|
1040 + | > for PokemonService<L>
|
1041 + | {
|
1042 + | const VALUE: Operation = Operation::CapturePokemon;
|
1043 + | }
|
1044 + | impl<L>
|
1045 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::CheckHealth>
|
1046 + | for PokemonService<L>
|
1047 + | {
|
1048 + | const VALUE: Operation = Operation::CheckHealth;
|
1049 + | }
|
1050 + | impl<L>
|
1051 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::DoNothing>
|
1052 + | for PokemonService<L>
|
1053 + | {
|
1054 + | const VALUE: Operation = Operation::DoNothing;
|
1055 + | }
|
1056 + | impl<L>
|
1057 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1058 + | crate::operation_shape::GetServerStatistics,
|
1059 + | > for PokemonService<L>
|
1060 + | {
|
1061 + | const VALUE: Operation = Operation::GetServerStatistics;
|
1062 + | }
|
1063 + |
|
1064 + | impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for PokemonService<S> {
|
1065 + | const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
|
1066 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1067 + | "com.aws.example#PokemonService",
|
1068 + | "com.aws.example",
|
1069 + | "PokemonService",
|
1070 + | );
|
1071 + |
|
1072 + | const VERSION: Option<&'static str> = Some("2024-03-18");
|
1073 + |
|
1074 + | type Protocol = ::aws_smithy_legacy_http_server::protocol::aws_json_10::AwsJson1_0;
|
1075 + |
|
1076 + | type Operations = Operation;
|
1077 + | }
|
1078 + | /// Configuration for the [`PokemonService`]. This is the central place where to register and
|
1079 + | /// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
|
1080 + | ///
|
1081 + | /// ```rust,no_run
|
1082 + | /// # use pokemon_service_awsjson_server_sdk_http0x::PokemonServiceConfig;
|
1083 + | /// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
|
1084 + | /// # use ::tower::layer::util::Identity;
|
1085 + | /// # let authentication_plugin = IdentityPlugin;
|
1086 + | /// # let authorization_plugin = IdentityPlugin;
|
1087 + | /// # let server_request_id_provider_layer = Identity::new();
|
1088 + | /// let config = PokemonServiceConfig::builder()
|
1089 + | /// // Layers get executed first...
|
1090 + | /// .layer(server_request_id_provider_layer)
|
1091 + | /// // ...then HTTP plugins...
|
1092 + | /// .http_plugin(authentication_plugin)
|
1093 + | /// // ...and right after deserialization, model plugins.
|
1094 + | /// .model_plugin(authorization_plugin)
|
1095 + | /// .build();
|
1096 + | /// ```
|
1097 + | ///
|
1098 + | /// See the [`plugin`] system for details.
|
1099 + | ///
|
1100 + | /// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
|
1101 + | #[derive(::std::fmt::Debug)]
|
1102 + | pub struct PokemonServiceConfig<L, H, M> {
|
1103 + | layers: L,
|
1104 + | http_plugins: H,
|
1105 + | model_plugins: M,
|
1106 + | }
|
1107 + |
|
1108 + | impl PokemonServiceConfig<(), (), ()> {
|
1109 + | /// Returns a builder to construct the configuration.
|
1110 + | pub fn builder() -> PokemonServiceConfigBuilder<
|
1111 + | ::tower::layer::util::Identity,
|
1112 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1113 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1114 + | > {
|
1115 + | PokemonServiceConfigBuilder {
|
1116 + | layers: ::tower::layer::util::Identity::new(),
|
1117 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1118 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1119 + | }
|
1120 + | }
|
1121 + | }
|
1122 + |
|
1123 + | /// Builder returned by [`PokemonServiceConfig::builder()`].
|
1124 + | #[derive(::std::fmt::Debug)]
|
1125 + | pub struct PokemonServiceConfigBuilder<L, H, M> {
|
1126 + | pub(crate) layers: L,
|
1127 + | pub(crate) http_plugins: H,
|
1128 + | pub(crate) model_plugins: M,
|
1129 + | }
|
1130 + |
|
1131 + | impl<L, H, M> PokemonServiceConfigBuilder<L, H, M> {
|
1132 + | /// Add a [`::tower::Layer`] to the service.
|
1133 + | pub fn layer<NewLayer>(
|
1134 + | self,
|
1135 + | layer: NewLayer,
|
1136 + | ) -> PokemonServiceConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
|
1137 + | PokemonServiceConfigBuilder {
|
1138 + | layers: ::tower::layer::util::Stack::new(layer, self.layers),
|
1139 + | http_plugins: self.http_plugins,
|
1140 + | model_plugins: self.model_plugins,
|
1141 + | }
|
1142 + | }
|
1143 + |
|
1144 + | /// Add a HTTP [plugin] to the service.
|
1145 + | ///
|
1146 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
1147 + | // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
|
1148 + | // errors get _substantially_ better if the user makes a mistake.
|
1149 + | pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
|
1150 + | self,
|
1151 + | http_plugin: NewPlugin,
|
1152 + | ) -> PokemonServiceConfigBuilder<
|
1153 + | L,
|
1154 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>,
|
1155 + | M,
|
1156 + | > {
|
1157 + | PokemonServiceConfigBuilder {
|
1158 + | layers: self.layers,
|
1159 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
1160 + | http_plugin,
|
1161 + | self.http_plugins,
|
1162 + | ),
|
1163 + | model_plugins: self.model_plugins,
|
1164 + | }
|
1165 + | }
|
1166 + |
|
1167 + | /// Add a model [plugin] to the service.
|
1168 + | ///
|
1169 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
1170 + | // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
|
1171 + | // errors get _substantially_ better if the user makes a mistake.
|
1172 + | pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
|
1173 + | self,
|
1174 + | model_plugin: NewPlugin,
|
1175 + | ) -> PokemonServiceConfigBuilder<
|
1176 + | L,
|
1177 + | H,
|
1178 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>,
|
1179 + | > {
|
1180 + | PokemonServiceConfigBuilder {
|
1181 + | layers: self.layers,
|
1182 + | http_plugins: self.http_plugins,
|
1183 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
1184 + | model_plugin,
|
1185 + | self.model_plugins,
|
1186 + | ),
|
1187 + | }
|
1188 + | }
|
1189 + |
|
1190 + | /// Build the configuration.
|
1191 + | pub fn build(self) -> super::PokemonServiceConfig<L, H, M> {
|
1192 + | super::PokemonServiceConfig {
|
1193 + | layers: self.layers,
|
1194 + | http_plugins: self.http_plugins,
|
1195 + | model_plugins: self.model_plugins,
|
1196 + | }
|
1197 + | }
|
1198 + | }
|
1199 + | /// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
|
1200 + | ///
|
1201 + | /// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
|
1202 + | /// of the service and any operations _not_ specified will be placed in the opposing group.
|
1203 + | ///
|
1204 + | /// # Example
|
1205 + | ///
|
1206 + | /// ```rust
|
1207 + | /// scope! {
|
1208 + | /// /// Includes [`CapturePokemon`], excluding all other operations.
|
1209 + | /// struct ScopeA {
|
1210 + | /// includes: [CapturePokemon]
|
1211 + | /// }
|
1212 + | /// }
|
1213 + | ///
|
1214 + | /// scope! {
|
1215 + | /// /// Excludes [`CapturePokemon`], excluding all other operations.
|
1216 + | /// struct ScopeB {
|
1217 + | /// excludes: [CapturePokemon]
|
1218 + | /// }
|
1219 + | /// }
|
1220 + | ///
|
1221 + | /// # use pokemon_service_awsjson_server_sdk_http0x::server::plugin::{Plugin, Scoped};
|
1222 + | /// # use pokemon_service_awsjson_server_sdk_http0x::scope;
|
1223 + | /// # struct MockPlugin;
|
1224 + | /// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
|
1225 + | /// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
|
1226 + | /// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
|
1227 + | /// # let a = Plugin::<(), pokemon_service_awsjson_server_sdk_http0x::operation_shape::CapturePokemon, u64>::apply(&scoped_a, 6);
|
1228 + | /// # let b = Plugin::<(), pokemon_service_awsjson_server_sdk_http0x::operation_shape::CapturePokemon, u64>::apply(&scoped_b, 6);
|
1229 + | /// # assert_eq!(a, 3_u32);
|
1230 + | /// # assert_eq!(b, 6_u64);
|
1231 + | /// ```
|
1232 + | #[macro_export]
|
1233 + | macro_rules! scope {
|
1234 + | // Completed, render impls
|
1235 + | (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
|
1236 + | $(
|
1237 + | impl $ crate::server::plugin::scoped::Membership<$ temp> for $ name {
|
1238 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
1239 + | }
|
1240 + | )*
|
1241 + | $(
|
1242 + | impl $ crate::server::plugin::scoped::Membership<$ not_member> for $ name {
|
1243 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
1244 + | }
|
1245 + | )*
|
1246 + | };
|
1247 + | // All `not_member`s exhausted, move `temp` into `not_member`
|
1248 + | (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
|
1249 + | scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
|
1250 + | };
|
1251 + |
|
1252 + | // CapturePokemon match found, pop from both `member` and `not_member`
|
1253 + | (@ $ name: ident, $ contains: ident (CapturePokemon $($ member: ident)*) ($($ temp: ident)*) (CapturePokemon $($ not_member: ident)*)) => {
|
1254 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1255 + | };
|
1256 + | // CapturePokemon match not found, pop from `not_member` into `temp` stack
|
1257 + | (@ $ name: ident, $ contains: ident (CapturePokemon $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1258 + | scope! { @ $ name, $ contains (CapturePokemon $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1259 + | };
|
1260 + |
|
1261 + | // CheckHealth match found, pop from both `member` and `not_member`
|
1262 + | (@ $ name: ident, $ contains: ident (CheckHealth $($ member: ident)*) ($($ temp: ident)*) (CheckHealth $($ not_member: ident)*)) => {
|
1263 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1264 + | };
|
1265 + | // CheckHealth match not found, pop from `not_member` into `temp` stack
|
1266 + | (@ $ name: ident, $ contains: ident (CheckHealth $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1267 + | scope! { @ $ name, $ contains (CheckHealth $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1268 + | };
|
1269 + |
|
1270 + | // DoNothing match found, pop from both `member` and `not_member`
|
1271 + | (@ $ name: ident, $ contains: ident (DoNothing $($ member: ident)*) ($($ temp: ident)*) (DoNothing $($ not_member: ident)*)) => {
|
1272 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1273 + | };
|
1274 + | // DoNothing match not found, pop from `not_member` into `temp` stack
|
1275 + | (@ $ name: ident, $ contains: ident (DoNothing $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1276 + | scope! { @ $ name, $ contains (DoNothing $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1277 + | };
|
1278 + |
|
1279 + | // GetServerStatistics match found, pop from both `member` and `not_member`
|
1280 + | (@ $ name: ident, $ contains: ident (GetServerStatistics $($ member: ident)*) ($($ temp: ident)*) (GetServerStatistics $($ not_member: ident)*)) => {
|
1281 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1282 + | };
|
1283 + | // GetServerStatistics match not found, pop from `not_member` into `temp` stack
|
1284 + | (@ $ name: ident, $ contains: ident (GetServerStatistics $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1285 + | scope! { @ $ name, $ contains (GetServerStatistics $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1286 + | };
|
1287 + |
|
1288 + | (
|
1289 + | $(#[$ attrs:meta])*
|
1290 + | $ vis:vis struct $ name:ident {
|
1291 + | includes: [$($ include:ident),*]
|
1292 + | }
|
1293 + | ) => {
|
1294 + | use $ crate::operation_shape::*;
|
1295 + | $ crate::server::scope! {
|
1296 + | $(#[$ attrs])*
|
1297 + | $ vis struct $ name {
|
1298 + | includes: [$($ include),*],
|
1299 + | excludes: []
|
1300 + | }
|
1301 + | }
|
1302 + | scope! { @ $ name, False ($($ include)*) () (CapturePokemon CheckHealth DoNothing GetServerStatistics) }
|
1303 + | };
|
1304 + | (
|
1305 + | $(#[$ attrs:meta])*
|
1306 + | $ vis:vis struct $ name:ident {
|
1307 + | excludes: [$($ exclude:ident),*]
|
1308 + | }
|
1309 + | ) => {
|
1310 + | use $ crate::operation_shape::*;
|
1311 + |
|
1312 + | $ crate::server::scope! {
|
1313 + | $(#[$ attrs])*
|
1314 + | $ vis struct $ name {
|
1315 + | includes: [],
|
1316 + | excludes: [$($ exclude),*]
|
1317 + | }
|
1318 + | }
|
1319 + | scope! { @ $ name, True ($($ exclude)*) () (CapturePokemon CheckHealth DoNothing GetServerStatistics) }
|
1320 + | };
|
1321 + | }
|