• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use serde::{Deserialize, Serialize};
2 struct SerNamedMap<'a, 'b, A: 'a, B: 'b, C> {
3     a: &'a A,
4     b: &'b mut B,
5     c: C,
6 }
7 #[doc(hidden)]
8 #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
9 const _: () = {
10     #[allow(unused_extern_crates, clippy::useless_attribute)]
11     extern crate serde as _serde;
12     #[automatically_derived]
13     impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedMap<'a, 'b, A, B, C>
14     where
15         A: _serde::Serialize,
16         B: _serde::Serialize,
17         C: _serde::Serialize,
18     {
serialize<__S>( &self, __serializer: __S, ) -> _serde::__private::Result<__S::Ok, __S::Error> where __S: _serde::Serializer,19         fn serialize<__S>(
20             &self,
21             __serializer: __S,
22         ) -> _serde::__private::Result<__S::Ok, __S::Error>
23         where
24             __S: _serde::Serializer,
25         {
26             let mut __serde_state = match _serde::Serializer::serialize_struct(
27                 __serializer,
28                 "SerNamedMap",
29                 false as usize + 1 + 1 + 1,
30             ) {
31                 _serde::__private::Ok(__val) => __val,
32                 _serde::__private::Err(__err) => {
33                     return _serde::__private::Err(__err);
34                 }
35             };
36             match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "a", &self.a) {
37                 _serde::__private::Ok(__val) => __val,
38                 _serde::__private::Err(__err) => {
39                     return _serde::__private::Err(__err);
40                 }
41             };
42             match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "b", &self.b) {
43                 _serde::__private::Ok(__val) => __val,
44                 _serde::__private::Err(__err) => {
45                     return _serde::__private::Err(__err);
46                 }
47             };
48             match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "c", &self.c) {
49                 _serde::__private::Ok(__val) => __val,
50                 _serde::__private::Err(__err) => {
51                     return _serde::__private::Err(__err);
52                 }
53             };
54             _serde::ser::SerializeStruct::end(__serde_state)
55         }
56     }
57 };
58 struct DeNamedMap<A, B, C> {
59     a: A,
60     b: B,
61     c: C,
62 }
63 #[doc(hidden)]
64 #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
65 const _: () = {
66     #[allow(unused_extern_crates, clippy::useless_attribute)]
67     extern crate serde as _serde;
68     #[automatically_derived]
69     impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedMap<A, B, C>
70     where
71         A: _serde::Deserialize<'de>,
72         B: _serde::Deserialize<'de>,
73         C: _serde::Deserialize<'de>,
74     {
deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> where __D: _serde::Deserializer<'de>,75         fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error>
76         where
77             __D: _serde::Deserializer<'de>,
78         {
79             #[allow(non_camel_case_types)]
80             enum __Field {
81                 __field0,
82                 __field1,
83                 __field2,
84                 __ignore,
85             }
86             struct __FieldVisitor;
87             impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
88                 type Value = __Field;
89                 fn expecting(
90                     &self,
91                     __formatter: &mut _serde::__private::Formatter,
92                 ) -> _serde::__private::fmt::Result {
93                     _serde::__private::Formatter::write_str(__formatter, "field identifier")
94                 }
95                 fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E>
96                 where
97                     __E: _serde::de::Error,
98                 {
99                     match __value {
100                         0u64 => _serde::__private::Ok(__Field::__field0),
101                         1u64 => _serde::__private::Ok(__Field::__field1),
102                         2u64 => _serde::__private::Ok(__Field::__field2),
103                         _ => _serde::__private::Ok(__Field::__ignore),
104                     }
105                 }
106                 fn visit_str<__E>(
107                     self,
108                     __value: &str,
109                 ) -> _serde::__private::Result<Self::Value, __E>
110                 where
111                     __E: _serde::de::Error,
112                 {
113                     match __value {
114                         "a" => _serde::__private::Ok(__Field::__field0),
115                         "b" => _serde::__private::Ok(__Field::__field1),
116                         "c" => _serde::__private::Ok(__Field::__field2),
117                         _ => _serde::__private::Ok(__Field::__ignore),
118                     }
119                 }
120                 fn visit_bytes<__E>(
121                     self,
122                     __value: &[u8],
123                 ) -> _serde::__private::Result<Self::Value, __E>
124                 where
125                     __E: _serde::de::Error,
126                 {
127                     match __value {
128                         b"a" => _serde::__private::Ok(__Field::__field0),
129                         b"b" => _serde::__private::Ok(__Field::__field1),
130                         b"c" => _serde::__private::Ok(__Field::__field2),
131                         _ => _serde::__private::Ok(__Field::__ignore),
132                     }
133                 }
134             }
135             impl<'de> _serde::Deserialize<'de> for __Field {
136                 #[inline]
137                 fn deserialize<__D>(
138                     __deserializer: __D,
139                 ) -> _serde::__private::Result<Self, __D::Error>
140                 where
141                     __D: _serde::Deserializer<'de>,
142                 {
143                     _serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor)
144                 }
145             }
146             struct __Visitor<'de, A, B, C>
147             where
148                 A: _serde::Deserialize<'de>,
149                 B: _serde::Deserialize<'de>,
150                 C: _serde::Deserialize<'de>,
151             {
152                 marker: _serde::__private::PhantomData<DeNamedMap<A, B, C>>,
153                 lifetime: _serde::__private::PhantomData<&'de ()>,
154             }
155             impl<'de, A, B, C> _serde::de::Visitor<'de> for __Visitor<'de, A, B, C>
156             where
157                 A: _serde::Deserialize<'de>,
158                 B: _serde::Deserialize<'de>,
159                 C: _serde::Deserialize<'de>,
160             {
161                 type Value = DeNamedMap<A, B, C>;
162                 fn expecting(
163                     &self,
164                     __formatter: &mut _serde::__private::Formatter,
165                 ) -> _serde::__private::fmt::Result {
166                     _serde::__private::Formatter::write_str(__formatter, "struct DeNamedMap")
167                 }
168                 #[inline]
169                 fn visit_seq<__A>(
170                     self,
171                     mut __seq: __A,
172                 ) -> _serde::__private::Result<Self::Value, __A::Error>
173                 where
174                     __A: _serde::de::SeqAccess<'de>,
175                 {
176                     let __field0 = match match _serde::de::SeqAccess::next_element::<A>(&mut __seq)
177                     {
178                         _serde::__private::Ok(__val) => __val,
179                         _serde::__private::Err(__err) => {
180                             return _serde::__private::Err(__err);
181                         }
182                     } {
183                         _serde::__private::Some(__value) => __value,
184                         _serde::__private::None => {
185                             return _serde::__private::Err(_serde::de::Error::invalid_length(
186                                 0usize,
187                                 &"struct DeNamedMap with 3 elements",
188                             ));
189                         }
190                     };
191                     let __field1 = match match _serde::de::SeqAccess::next_element::<B>(&mut __seq)
192                     {
193                         _serde::__private::Ok(__val) => __val,
194                         _serde::__private::Err(__err) => {
195                             return _serde::__private::Err(__err);
196                         }
197                     } {
198                         _serde::__private::Some(__value) => __value,
199                         _serde::__private::None => {
200                             return _serde::__private::Err(_serde::de::Error::invalid_length(
201                                 1usize,
202                                 &"struct DeNamedMap with 3 elements",
203                             ));
204                         }
205                     };
206                     let __field2 = match match _serde::de::SeqAccess::next_element::<C>(&mut __seq)
207                     {
208                         _serde::__private::Ok(__val) => __val,
209                         _serde::__private::Err(__err) => {
210                             return _serde::__private::Err(__err);
211                         }
212                     } {
213                         _serde::__private::Some(__value) => __value,
214                         _serde::__private::None => {
215                             return _serde::__private::Err(_serde::de::Error::invalid_length(
216                                 2usize,
217                                 &"struct DeNamedMap with 3 elements",
218                             ));
219                         }
220                     };
221                     _serde::__private::Ok(DeNamedMap {
222                         a: __field0,
223                         b: __field1,
224                         c: __field2,
225                     })
226                 }
227                 #[inline]
228                 fn visit_map<__A>(
229                     self,
230                     mut __map: __A,
231                 ) -> _serde::__private::Result<Self::Value, __A::Error>
232                 where
233                     __A: _serde::de::MapAccess<'de>,
234                 {
235                     let mut __field0: _serde::__private::Option<A> = _serde::__private::None;
236                     let mut __field1: _serde::__private::Option<B> = _serde::__private::None;
237                     let mut __field2: _serde::__private::Option<C> = _serde::__private::None;
238                     while let _serde::__private::Some(__key) =
239                         match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
240                             _serde::__private::Ok(__val) => __val,
241                             _serde::__private::Err(__err) => {
242                                 return _serde::__private::Err(__err);
243                             }
244                         }
245                     {
246                         match __key {
247                             __Field::__field0 => {
248                                 if _serde::__private::Option::is_some(&__field0) {
249                                     return _serde::__private::Err(
250                                         <__A::Error as _serde::de::Error>::duplicate_field("a"),
251                                     );
252                                 }
253                                 __field0 = _serde::__private::Some(
254                                     match _serde::de::MapAccess::next_value::<A>(&mut __map) {
255                                         _serde::__private::Ok(__val) => __val,
256                                         _serde::__private::Err(__err) => {
257                                             return _serde::__private::Err(__err);
258                                         }
259                                     },
260                                 );
261                             }
262                             __Field::__field1 => {
263                                 if _serde::__private::Option::is_some(&__field1) {
264                                     return _serde::__private::Err(
265                                         <__A::Error as _serde::de::Error>::duplicate_field("b"),
266                                     );
267                                 }
268                                 __field1 = _serde::__private::Some(
269                                     match _serde::de::MapAccess::next_value::<B>(&mut __map) {
270                                         _serde::__private::Ok(__val) => __val,
271                                         _serde::__private::Err(__err) => {
272                                             return _serde::__private::Err(__err);
273                                         }
274                                     },
275                                 );
276                             }
277                             __Field::__field2 => {
278                                 if _serde::__private::Option::is_some(&__field2) {
279                                     return _serde::__private::Err(
280                                         <__A::Error as _serde::de::Error>::duplicate_field("c"),
281                                     );
282                                 }
283                                 __field2 = _serde::__private::Some(
284                                     match _serde::de::MapAccess::next_value::<C>(&mut __map) {
285                                         _serde::__private::Ok(__val) => __val,
286                                         _serde::__private::Err(__err) => {
287                                             return _serde::__private::Err(__err);
288                                         }
289                                     },
290                                 );
291                             }
292                             _ => {
293                                 let _ = match _serde::de::MapAccess::next_value::<
294                                     _serde::de::IgnoredAny,
295                                 >(&mut __map)
296                                 {
297                                     _serde::__private::Ok(__val) => __val,
298                                     _serde::__private::Err(__err) => {
299                                         return _serde::__private::Err(__err);
300                                     }
301                                 };
302                             }
303                         }
304                     }
305                     let __field0 = match __field0 {
306                         _serde::__private::Some(__field0) => __field0,
307                         _serde::__private::None => {
308                             match _serde::__private::de::missing_field("a") {
309                                 _serde::__private::Ok(__val) => __val,
310                                 _serde::__private::Err(__err) => {
311                                     return _serde::__private::Err(__err);
312                                 }
313                             }
314                         }
315                     };
316                     let __field1 = match __field1 {
317                         _serde::__private::Some(__field1) => __field1,
318                         _serde::__private::None => {
319                             match _serde::__private::de::missing_field("b") {
320                                 _serde::__private::Ok(__val) => __val,
321                                 _serde::__private::Err(__err) => {
322                                     return _serde::__private::Err(__err);
323                                 }
324                             }
325                         }
326                     };
327                     let __field2 = match __field2 {
328                         _serde::__private::Some(__field2) => __field2,
329                         _serde::__private::None => {
330                             match _serde::__private::de::missing_field("c") {
331                                 _serde::__private::Ok(__val) => __val,
332                                 _serde::__private::Err(__err) => {
333                                     return _serde::__private::Err(__err);
334                                 }
335                             }
336                         }
337                     };
338                     _serde::__private::Ok(DeNamedMap {
339                         a: __field0,
340                         b: __field1,
341                         c: __field2,
342                     })
343                 }
344             }
345             const FIELDS: &'static [&'static str] = &["a", "b", "c"];
346             _serde::Deserializer::deserialize_struct(
347                 __deserializer,
348                 "DeNamedMap",
349                 FIELDS,
350                 __Visitor {
351                     marker: _serde::__private::PhantomData::<DeNamedMap<A, B, C>>,
352                     lifetime: _serde::__private::PhantomData,
353                 },
354             )
355         }
deserialize_in_place<__D>( __deserializer: __D, __place: &mut Self, ) -> _serde::__private::Result<(), __D::Error> where __D: _serde::Deserializer<'de>,356         fn deserialize_in_place<__D>(
357             __deserializer: __D,
358             __place: &mut Self,
359         ) -> _serde::__private::Result<(), __D::Error>
360         where
361             __D: _serde::Deserializer<'de>,
362         {
363             #[allow(non_camel_case_types)]
364             enum __Field {
365                 __field0,
366                 __field1,
367                 __field2,
368                 __ignore,
369             }
370             struct __FieldVisitor;
371             impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
372                 type Value = __Field;
373                 fn expecting(
374                     &self,
375                     __formatter: &mut _serde::__private::Formatter,
376                 ) -> _serde::__private::fmt::Result {
377                     _serde::__private::Formatter::write_str(__formatter, "field identifier")
378                 }
379                 fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E>
380                 where
381                     __E: _serde::de::Error,
382                 {
383                     match __value {
384                         0u64 => _serde::__private::Ok(__Field::__field0),
385                         1u64 => _serde::__private::Ok(__Field::__field1),
386                         2u64 => _serde::__private::Ok(__Field::__field2),
387                         _ => _serde::__private::Ok(__Field::__ignore),
388                     }
389                 }
390                 fn visit_str<__E>(
391                     self,
392                     __value: &str,
393                 ) -> _serde::__private::Result<Self::Value, __E>
394                 where
395                     __E: _serde::de::Error,
396                 {
397                     match __value {
398                         "a" => _serde::__private::Ok(__Field::__field0),
399                         "b" => _serde::__private::Ok(__Field::__field1),
400                         "c" => _serde::__private::Ok(__Field::__field2),
401                         _ => _serde::__private::Ok(__Field::__ignore),
402                     }
403                 }
404                 fn visit_bytes<__E>(
405                     self,
406                     __value: &[u8],
407                 ) -> _serde::__private::Result<Self::Value, __E>
408                 where
409                     __E: _serde::de::Error,
410                 {
411                     match __value {
412                         b"a" => _serde::__private::Ok(__Field::__field0),
413                         b"b" => _serde::__private::Ok(__Field::__field1),
414                         b"c" => _serde::__private::Ok(__Field::__field2),
415                         _ => _serde::__private::Ok(__Field::__ignore),
416                     }
417                 }
418             }
419             impl<'de> _serde::Deserialize<'de> for __Field {
420                 #[inline]
421                 fn deserialize<__D>(
422                     __deserializer: __D,
423                 ) -> _serde::__private::Result<Self, __D::Error>
424                 where
425                     __D: _serde::Deserializer<'de>,
426                 {
427                     _serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor)
428                 }
429             }
430             struct __Visitor<'de, 'place, A: 'place, B: 'place, C: 'place>
431             where
432                 A: _serde::Deserialize<'de>,
433                 B: _serde::Deserialize<'de>,
434                 C: _serde::Deserialize<'de>,
435             {
436                 place: &'place mut DeNamedMap<A, B, C>,
437                 lifetime: _serde::__private::PhantomData<&'de ()>,
438             }
439             impl<'de, 'place, A: 'place, B: 'place, C: 'place> _serde::de::Visitor<'de>
440                 for __Visitor<'de, 'place, A, B, C>
441             where
442                 A: _serde::Deserialize<'de>,
443                 B: _serde::Deserialize<'de>,
444                 C: _serde::Deserialize<'de>,
445             {
446                 type Value = ();
447                 fn expecting(
448                     &self,
449                     __formatter: &mut _serde::__private::Formatter,
450                 ) -> _serde::__private::fmt::Result {
451                     _serde::__private::Formatter::write_str(__formatter, "struct DeNamedMap")
452                 }
453                 #[inline]
454                 fn visit_seq<__A>(
455                     self,
456                     mut __seq: __A,
457                 ) -> _serde::__private::Result<Self::Value, __A::Error>
458                 where
459                     __A: _serde::de::SeqAccess<'de>,
460                 {
461                     if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed(
462                         &mut __seq,
463                         _serde::__private::de::InPlaceSeed(&mut self.place.a),
464                     ) {
465                         _serde::__private::Ok(__val) => __val,
466                         _serde::__private::Err(__err) => {
467                             return _serde::__private::Err(__err);
468                         }
469                     } {
470                         return _serde::__private::Err(_serde::de::Error::invalid_length(
471                             0usize,
472                             &"struct DeNamedMap with 3 elements",
473                         ));
474                     }
475                     if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed(
476                         &mut __seq,
477                         _serde::__private::de::InPlaceSeed(&mut self.place.b),
478                     ) {
479                         _serde::__private::Ok(__val) => __val,
480                         _serde::__private::Err(__err) => {
481                             return _serde::__private::Err(__err);
482                         }
483                     } {
484                         return _serde::__private::Err(_serde::de::Error::invalid_length(
485                             1usize,
486                             &"struct DeNamedMap with 3 elements",
487                         ));
488                     }
489                     if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed(
490                         &mut __seq,
491                         _serde::__private::de::InPlaceSeed(&mut self.place.c),
492                     ) {
493                         _serde::__private::Ok(__val) => __val,
494                         _serde::__private::Err(__err) => {
495                             return _serde::__private::Err(__err);
496                         }
497                     } {
498                         return _serde::__private::Err(_serde::de::Error::invalid_length(
499                             2usize,
500                             &"struct DeNamedMap with 3 elements",
501                         ));
502                     }
503                     _serde::__private::Ok(())
504                 }
505                 #[inline]
506                 fn visit_map<__A>(
507                     self,
508                     mut __map: __A,
509                 ) -> _serde::__private::Result<Self::Value, __A::Error>
510                 where
511                     __A: _serde::de::MapAccess<'de>,
512                 {
513                     let mut __field0: bool = false;
514                     let mut __field1: bool = false;
515                     let mut __field2: bool = false;
516                     while let _serde::__private::Some(__key) =
517                         match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
518                             _serde::__private::Ok(__val) => __val,
519                             _serde::__private::Err(__err) => {
520                                 return _serde::__private::Err(__err);
521                             }
522                         }
523                     {
524                         match __key {
525                             __Field::__field0 => {
526                                 if __field0 {
527                                     return _serde::__private::Err(
528                                         <__A::Error as _serde::de::Error>::duplicate_field("a"),
529                                     );
530                                 }
531                                 match _serde::de::MapAccess::next_value_seed(
532                                     &mut __map,
533                                     _serde::__private::de::InPlaceSeed(&mut self.place.a),
534                                 ) {
535                                     _serde::__private::Ok(__val) => __val,
536                                     _serde::__private::Err(__err) => {
537                                         return _serde::__private::Err(__err);
538                                     }
539                                 };
540                                 __field0 = true;
541                             }
542                             __Field::__field1 => {
543                                 if __field1 {
544                                     return _serde::__private::Err(
545                                         <__A::Error as _serde::de::Error>::duplicate_field("b"),
546                                     );
547                                 }
548                                 match _serde::de::MapAccess::next_value_seed(
549                                     &mut __map,
550                                     _serde::__private::de::InPlaceSeed(&mut self.place.b),
551                                 ) {
552                                     _serde::__private::Ok(__val) => __val,
553                                     _serde::__private::Err(__err) => {
554                                         return _serde::__private::Err(__err);
555                                     }
556                                 };
557                                 __field1 = true;
558                             }
559                             __Field::__field2 => {
560                                 if __field2 {
561                                     return _serde::__private::Err(
562                                         <__A::Error as _serde::de::Error>::duplicate_field("c"),
563                                     );
564                                 }
565                                 match _serde::de::MapAccess::next_value_seed(
566                                     &mut __map,
567                                     _serde::__private::de::InPlaceSeed(&mut self.place.c),
568                                 ) {
569                                     _serde::__private::Ok(__val) => __val,
570                                     _serde::__private::Err(__err) => {
571                                         return _serde::__private::Err(__err);
572                                     }
573                                 };
574                                 __field2 = true;
575                             }
576                             _ => {
577                                 let _ = match _serde::de::MapAccess::next_value::<
578                                     _serde::de::IgnoredAny,
579                                 >(&mut __map)
580                                 {
581                                     _serde::__private::Ok(__val) => __val,
582                                     _serde::__private::Err(__err) => {
583                                         return _serde::__private::Err(__err);
584                                     }
585                                 };
586                             }
587                         }
588                     }
589                     if !__field0 {
590                         self.place.a = match _serde::__private::de::missing_field("a") {
591                             _serde::__private::Ok(__val) => __val,
592                             _serde::__private::Err(__err) => {
593                                 return _serde::__private::Err(__err);
594                             }
595                         };
596                     };
597                     if !__field1 {
598                         self.place.b = match _serde::__private::de::missing_field("b") {
599                             _serde::__private::Ok(__val) => __val,
600                             _serde::__private::Err(__err) => {
601                                 return _serde::__private::Err(__err);
602                             }
603                         };
604                     };
605                     if !__field2 {
606                         self.place.c = match _serde::__private::de::missing_field("c") {
607                             _serde::__private::Ok(__val) => __val,
608                             _serde::__private::Err(__err) => {
609                                 return _serde::__private::Err(__err);
610                             }
611                         };
612                     };
613                     _serde::__private::Ok(())
614                 }
615             }
616             const FIELDS: &'static [&'static str] = &["a", "b", "c"];
617             _serde::Deserializer::deserialize_struct(
618                 __deserializer,
619                 "DeNamedMap",
620                 FIELDS,
621                 __Visitor {
622                     place: __place,
623                     lifetime: _serde::__private::PhantomData,
624                 },
625             )
626         }
627     }
628 };
629