42 42 | /// Interceptor context for the `read_before_execution` and `read_before_serialization` hooks.
|
43 43 | ///
|
44 44 | /// Only the input is available at this point in the operation.
|
45 45 | #[derive(Debug)]
|
46 46 | pub struct BeforeSerializationInterceptorContextRef<'a, I = Input, O = Output, E = Error> {
|
47 47 | inner: &'a InterceptorContext<I, O, E>,
|
48 48 | }
|
49 49 |
|
50 50 | impl_from_interceptor_context!(ref BeforeSerializationInterceptorContextRef);
|
51 51 |
|
52 - | impl<'a, I, O, E> BeforeSerializationInterceptorContextRef<'a, I, O, E> {
|
52 + | impl<I, O, E> BeforeSerializationInterceptorContextRef<'_, I, O, E> {
|
53 53 | /// Returns a reference to the input.
|
54 54 | pub fn input(&self) -> &I {
|
55 55 | expect!(self, input)
|
56 56 | }
|
57 57 |
|
58 58 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
59 59 | ///
|
60 60 | /// There's no good reason to use this unless you're writing tests or you have to
|
61 61 | /// interact with an API that doesn't support the context wrapper structs.
|
62 62 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
63 63 | self.inner
|
64 64 | }
|
65 65 | }
|
66 66 |
|
67 67 | //
|
68 68 | // BeforeSerializationInterceptorContextMut
|
69 69 | //
|
70 70 |
|
71 71 | /// Interceptor context for the `modify_before_serialization` hook.
|
72 72 | ///
|
73 73 | /// Only the input is available at this point in the operation.
|
74 74 | #[derive(Debug)]
|
75 75 | pub struct BeforeSerializationInterceptorContextMut<'a, I = Input, O = Output, E = Error> {
|
76 76 | inner: &'a mut InterceptorContext<I, O, E>,
|
77 77 | }
|
78 78 |
|
79 79 | impl_from_interceptor_context!(mut BeforeSerializationInterceptorContextMut);
|
80 80 |
|
81 - | impl<'a, I, O, E> BeforeSerializationInterceptorContextMut<'a, I, O, E> {
|
81 + | impl<I, O, E> BeforeSerializationInterceptorContextMut<'_, I, O, E> {
|
82 82 | /// Returns a reference to the input.
|
83 83 | pub fn input(&self) -> &I {
|
84 84 | expect!(self, input)
|
85 85 | }
|
86 86 |
|
87 87 | /// Returns a mutable reference to the input.
|
88 88 | pub fn input_mut(&mut self) -> &mut I {
|
89 89 | expect!(self, input_mut)
|
90 90 | }
|
91 91 |
|
92 92 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
93 93 | ///
|
94 94 | /// There's no good reason to use this unless you're writing tests or you have to
|
95 95 | /// interact with an API that doesn't support the context wrapper structs.
|
96 96 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
97 97 | self.inner
|
98 98 | }
|
99 99 |
|
100 100 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
101 101 | ///
|
102 102 | /// There's no good reason to use this unless you're writing tests or you have to
|
103 103 | /// interact with an API that doesn't support the context wrapper structs.
|
104 104 | pub fn inner_mut(&mut self) -> &'_ mut InterceptorContext<I, O, E> {
|
105 105 | self.inner
|
106 106 | }
|
107 107 | }
|
108 108 |
|
109 109 | //
|
110 110 | // BeforeSerializationInterceptorContextRef
|
111 111 | //
|
112 112 |
|
113 113 | /// Interceptor context for several hooks in between serialization and transmission.
|
114 114 | ///
|
115 115 | /// Only the request is available at this point in the operation.
|
116 116 | #[derive(Debug)]
|
117 117 | pub struct BeforeTransmitInterceptorContextRef<'a, I = Input, O = Output, E = Error> {
|
118 118 | inner: &'a InterceptorContext<I, O, E>,
|
119 119 | }
|
120 120 |
|
121 121 | impl_from_interceptor_context!(ref BeforeTransmitInterceptorContextRef);
|
122 122 |
|
123 - | impl<'a, I, O, E> BeforeTransmitInterceptorContextRef<'a, I, O, E> {
|
123 + | impl<I, O, E> BeforeTransmitInterceptorContextRef<'_, I, O, E> {
|
124 124 | /// Returns a reference to the transmittable request for the operation being invoked.
|
125 125 | pub fn request(&self) -> &Request {
|
126 126 | expect!(self, request)
|
127 127 | }
|
128 128 |
|
129 129 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
130 130 | ///
|
131 131 | /// There's no good reason to use this unless you're writing tests or you have to
|
132 132 | /// interact with an API that doesn't support the context wrapper structs.
|
133 133 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
134 134 | self.inner
|
135 135 | }
|
136 136 | }
|
137 137 |
|
138 138 | //
|
139 139 | // BeforeSerializationInterceptorContextMut
|
140 140 | //
|
141 141 |
|
142 142 | /// Interceptor context for several hooks in between serialization and transmission.
|
143 143 | ///
|
144 144 | /// Only the request is available at this point in the operation.
|
145 145 | #[derive(Debug)]
|
146 146 | pub struct BeforeTransmitInterceptorContextMut<'a, I = Input, O = Output, E = Error> {
|
147 147 | inner: &'a mut InterceptorContext<I, O, E>,
|
148 148 | }
|
149 149 |
|
150 150 | impl_from_interceptor_context!(mut BeforeTransmitInterceptorContextMut);
|
151 151 |
|
152 - | impl<'a, I, O, E> BeforeTransmitInterceptorContextMut<'a, I, O, E> {
|
152 + | impl<I, O, E> BeforeTransmitInterceptorContextMut<'_, I, O, E> {
|
153 153 | /// Returns a reference to the transmittable request for the operation being invoked.
|
154 154 | pub fn request(&self) -> &Request {
|
155 155 | expect!(self, request)
|
156 156 | }
|
157 157 |
|
158 158 | /// Returns a mutable reference to the transmittable request for the operation being invoked.
|
159 159 | pub fn request_mut(&mut self) -> &mut Request {
|
160 160 | expect!(self, request_mut)
|
161 161 | }
|
162 162 |
|
163 163 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
164 164 | ///
|
165 165 | /// There's no good reason to use this unless you're writing tests or you have to
|
166 166 | /// interact with an API that doesn't support the context wrapper structs.
|
167 167 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
168 168 | self.inner
|
169 169 | }
|
170 170 |
|
171 171 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
172 172 | ///
|
173 173 | /// There's no good reason to use this unless you're writing tests or you have to
|
174 174 | /// interact with an API that doesn't support the context wrapper structs.
|
175 175 | pub fn inner_mut(&mut self) -> &'_ mut InterceptorContext<I, O, E> {
|
176 176 | self.inner
|
177 177 | }
|
178 178 | }
|
179 179 |
|
180 180 | //
|
181 181 | // BeforeDeserializationInterceptorContextRef
|
182 182 | //
|
183 183 |
|
184 184 | /// Interceptor context for hooks before deserializing the response.
|
185 185 | ///
|
186 186 | /// Only the response is available at this point in the operation.
|
187 187 | #[derive(Debug)]
|
188 188 | pub struct BeforeDeserializationInterceptorContextRef<'a, I = Input, O = Output, E = Error> {
|
189 189 | inner: &'a InterceptorContext<I, O, E>,
|
190 190 | }
|
191 191 |
|
192 192 | impl_from_interceptor_context!(ref BeforeDeserializationInterceptorContextRef);
|
193 193 |
|
194 - | impl<'a, I, O, E> BeforeDeserializationInterceptorContextRef<'a, I, O, E> {
|
194 + | impl<I, O, E> BeforeDeserializationInterceptorContextRef<'_, I, O, E> {
|
195 195 | /// Returns a reference to the response.
|
196 196 | pub fn response(&self) -> &Response {
|
197 197 | expect!(self, response)
|
198 198 | }
|
199 199 |
|
200 200 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
201 201 | ///
|
202 202 | /// There's no good reason to use this unless you're writing tests or you have to
|
203 203 | /// interact with an API that doesn't support the context wrapper structs.
|
204 204 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
205 205 | self.inner
|
206 206 | }
|
207 207 | }
|
208 208 |
|
209 209 | //
|
210 210 | // BeforeDeserializationInterceptorContextMut
|
211 211 | //
|
212 212 |
|
213 213 | /// Interceptor context for hooks before deserializing the response.
|
214 214 | ///
|
215 215 | /// Only the response is available at this point in the operation.
|
216 216 | pub struct BeforeDeserializationInterceptorContextMut<'a, I = Input, O = Output, E = Error> {
|
217 217 | inner: &'a mut InterceptorContext<I, O, E>,
|
218 218 | }
|
219 219 |
|
220 220 | impl_from_interceptor_context!(mut BeforeDeserializationInterceptorContextMut);
|
221 221 |
|
222 - | impl<'a, I, O, E> BeforeDeserializationInterceptorContextMut<'a, I, O, E> {
|
222 + | impl<I, O, E> BeforeDeserializationInterceptorContextMut<'_, I, O, E> {
|
223 223 | /// Returns a reference to the response.
|
224 224 | pub fn response(&self) -> &Response {
|
225 225 | expect!(self, response)
|
226 226 | }
|
227 227 |
|
228 228 | /// Returns a mutable reference to the response.
|
229 229 | pub fn response_mut(&mut self) -> &mut Response {
|
230 230 | expect!(self, response_mut)
|
231 231 | }
|
232 232 |
|
233 233 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
234 234 | ///
|
235 235 | /// There's no good reason to use this unless you're writing tests or you have to
|
236 236 | /// interact with an API that doesn't support the context wrapper structs.
|
237 237 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
238 238 | self.inner
|
239 239 | }
|
240 240 |
|
241 241 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
242 242 | ///
|
243 243 | /// There's no good reason to use this unless you're writing tests or you have to
|
244 244 | /// interact with an API that doesn't support the context wrapper structs.
|
245 245 | pub fn inner_mut(&mut self) -> &'_ mut InterceptorContext<I, O, E> {
|
246 246 | self.inner
|
247 247 | }
|
248 248 | }
|
249 249 |
|
250 250 | //
|
251 251 | // AfterDeserializationInterceptorContextRef
|
252 252 | //
|
253 253 |
|
254 254 | /// Interceptor context for hooks after deserializing the response.
|
255 255 | ///
|
256 256 | /// The response and the deserialized output or error are available at this point in the operation.
|
257 257 | pub struct AfterDeserializationInterceptorContextRef<'a, I = Input, O = Output, E = Error> {
|
258 258 | inner: &'a InterceptorContext<I, O, E>,
|
259 259 | }
|
260 260 |
|
261 261 | impl_from_interceptor_context!(ref AfterDeserializationInterceptorContextRef);
|
262 262 |
|
263 - | impl<'a, I, O, E> AfterDeserializationInterceptorContextRef<'a, I, O, E> {
|
263 + | impl<I, O, E> AfterDeserializationInterceptorContextRef<'_, I, O, E> {
|
264 264 | /// Returns a reference to the response.
|
265 265 | pub fn response(&self) -> &Response {
|
266 266 | expect!(self, response)
|
267 267 | }
|
268 268 |
|
269 269 | /// Returns a reference to the deserialized output or error.
|
270 270 | pub fn output_or_error(&self) -> Result<&O, &OrchestratorError<E>> {
|
271 271 | expect!(self, output_or_error)
|
272 272 | }
|
273 273 |
|
274 274 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
275 275 | ///
|
276 276 | /// There's no good reason to use this unless you're writing tests or you have to
|
277 277 | /// interact with an API that doesn't support the context wrapper structs.
|
278 278 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
279 279 | self.inner
|
280 280 | }
|
281 281 | }
|
282 282 |
|
283 283 | //
|
284 284 | // FinalizerInterceptorContextRef
|
285 285 | //
|
286 286 |
|
287 287 | /// Interceptor context for finalization hooks.
|
288 288 | ///
|
289 289 | /// This context is used by the `read_after_attempt` and `read_after_execution` hooks
|
290 290 | /// that are all called upon both success and failure, and may have varying levels
|
291 291 | /// of context available depending on where a failure occurred if the operation failed.
|
292 292 | pub struct FinalizerInterceptorContextRef<'a, I = Input, O = Output, E = Error> {
|
293 293 | inner: &'a InterceptorContext<I, O, E>,
|
294 294 | }
|
295 295 |
|
296 296 | impl_from_interceptor_context!(ref FinalizerInterceptorContextRef);
|
297 297 |
|
298 - | impl<'a, I, O, E> FinalizerInterceptorContextRef<'a, I, O, E> {
|
298 + | impl<I, O, E> FinalizerInterceptorContextRef<'_, I, O, E> {
|
299 299 | /// Returns the operation input.
|
300 300 | pub fn input(&self) -> Option<&I> {
|
301 301 | self.inner.input.as_ref()
|
302 302 | }
|
303 303 |
|
304 304 | /// Returns the serialized request.
|
305 305 | pub fn request(&self) -> Option<&Request> {
|
306 306 | self.inner.request.as_ref()
|
307 307 | }
|
308 308 |
|
309 309 | /// Returns the raw response.
|
310 310 | pub fn response(&self) -> Option<&Response> {
|
311 311 | self.inner.response.as_ref()
|
312 312 | }
|
313 313 |
|
314 314 | /// Returns the deserialized operation output or error.
|
315 315 | pub fn output_or_error(&self) -> Option<Result<&O, &OrchestratorError<E>>> {
|
316 316 | self.inner.output_or_error.as_ref().map(|o| o.as_ref())
|
317 317 | }
|
318 318 |
|
319 319 | /// Downgrade this wrapper struct, returning the underlying InterceptorContext.
|
320 320 | ///
|
321 321 | /// There's no good reason to use this unless you're writing tests or you have to
|
322 322 | /// interact with an API that doesn't support the context wrapper structs.
|
323 323 | pub fn inner(&self) -> &'_ InterceptorContext<I, O, E> {
|
324 324 | self.inner
|
325 325 | }
|
326 326 | }
|
327 327 |
|
328 328 | //
|
329 329 | // FinalizerInterceptorContextMut
|
330 330 | //
|
331 331 |
|
332 332 | /// Interceptor context for finalization hooks.
|
333 333 | ///
|
334 334 | /// This context is used by the `modify_before_attempt_completion` and `modify_before_completion` hooks
|
335 335 | /// that are all called upon both success and failure, and may have varying levels
|
336 336 | /// of context available depending on where a failure occurred if the operation failed.
|
337 337 | pub struct FinalizerInterceptorContextMut<'a, I = Input, O = Output, E = Error> {
|
338 338 | inner: &'a mut InterceptorContext<I, O, E>,
|
339 339 | }
|
340 340 |
|
341 341 | impl_from_interceptor_context!(mut FinalizerInterceptorContextMut);
|
342 342 |
|
343 - | impl<'a, I, O, E> FinalizerInterceptorContextMut<'a, I, O, E> {
|
343 + | impl<I, O, E> FinalizerInterceptorContextMut<'_, I, O, E> {
|
344 344 | /// Returns the operation input.
|
345 345 | pub fn input(&self) -> Option<&I> {
|
346 346 | self.inner.input.as_ref()
|
347 347 | }
|
348 348 |
|
349 349 | /// Returns the serialized request.
|
350 350 | pub fn request(&self) -> Option<&Request> {
|
351 351 | self.inner.request.as_ref()
|
352 352 | }
|
353 353 |
|