spread_layout.rs 31.8 KB
Newer Older
1
// Copyright 2018-2021 Parity Technologies (UK) Ltd.
2
3
4
5
6
7
8
9
10
11
12
13
14
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

15
16
17
18
19
20
21
22
// These tests are partly testing if code is expanded correctly.
// Hence the syntax contains a number of verbose statements which
// are not properly cleaned up.
#![allow(clippy::absurd_extreme_comparisons)]
#![allow(clippy::identity_op)]
#![allow(clippy::eq_op)]
#![allow(clippy::match_single_binding)]

23
24
25
26
27
28
29
30
31
use crate::spread_layout_derive;

#[test]
fn unit_struct_works() {
    synstructure::test_derive! {
        spread_layout_derive {
            struct UnitStruct;
        }
        expands to {
32
            const _: () = {
33
                impl ::ink_storage::traits::SpreadLayout for UnitStruct {
34
                    #[allow(unused_comparisons)]
35
                    const FOOTPRINT: ::core::primitive::u64 = [0u64, 0u64][(0u64 < 0u64) as ::core::primitive::usize];
36

37
                    const REQUIRES_DEEP_CLEAN_UP : ::core::primitive::bool = (false || false );
38

39
                    fn pull_spread(__key_ptr: &mut ::ink_storage::traits::KeyPtr) -> Self {
40
41
42
                        UnitStruct
                    }

43
                    fn push_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
44
45
46
47
48
                        match self {
                            UnitStruct => {}
                        }
                    }

49
                    fn clear_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
                        match self {
                            UnitStruct => {}
                        }
                    }
                }
            };
        }
    }
}

#[test]
fn struct_works() {
    synstructure::test_derive! {
        spread_layout_derive {
            struct NamedFields {
                a: i32,
                b: [u8; 32],
                d: Box<i32>,
            }
        }
        expands to {
71
            const _: () = {
72
                impl ::ink_storage::traits::SpreadLayout for NamedFields {
73
                    #[allow(unused_comparisons)]
74
                    const FOOTPRINT: ::core::primitive::u64 = [
75
76
77
                        (((0u64 + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                            + <[u8; 32] as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                            + <Box<i32> as ::ink_storage::traits::SpreadLayout>::FOOTPRINT),
78
79
                        0u64
                    ][((((0u64
80
81
82
                        + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                        + <[u8; 32] as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                        + <Box<i32> as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
83
                        < 0u64) as ::core::primitive::usize
84
85
                    ];

86
                    const REQUIRES_DEEP_CLEAN_UP : ::core::primitive::bool = (
87
88
89
90
                        false || (
                            (
                                (
                                    false
91
                                    || <i32 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
92
                                )
93
                                || <[u8; 32] as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
94
                            )
95
                            || <Box<i32> as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
96
97
98
                        )
                    );

99
                    fn pull_spread(__key_ptr: &mut ::ink_storage::traits::KeyPtr) -> Self {
100
                        NamedFields {
101
102
103
                            a : <i32 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
                            b : <[u8; 32] as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
                            d : <Box<i32> as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
104
105
106
                        }
                    }

107
                    fn push_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
108
109
110
111
112
113
114
                        match self {
                            NamedFields {
                                a: __binding_0,
                                b: __binding_1,
                                d: __binding_2,
                            } => {
                                {
115
                                    ::ink_storage::traits::SpreadLayout::push_spread(
116
117
118
119
120
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
121
                                    ::ink_storage::traits::SpreadLayout::push_spread(
122
123
124
125
126
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                                {
127
                                    ::ink_storage::traits::SpreadLayout::push_spread(
128
129
130
131
132
133
134
135
                                        __binding_2,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }

136
                    fn clear_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
137
138
139
140
141
142
143
                        match self {
                            NamedFields {
                                a: __binding_0,
                                b: __binding_1,
                                d: __binding_2,
                            } => {
                                {
144
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
145
146
147
148
149
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
150
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
151
152
153
154
155
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                                {
156
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
                                        __binding_2,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }
                }
            };
        }
    }
}

#[test]
fn enum_works() {
    synstructure::test_derive! {
        spread_layout_derive {
            enum MixedEnum {
                A,
                B(i32, [u8; 32]),
                C { a: i32, b: (bool, i32) },
            }
        }
        expands to {
181
            const _: () = {
182
                impl ::ink_storage::traits::SpreadLayout for MixedEnum {
183
                    #[allow(unused_comparisons)]
184
                    const FOOTPRINT : ::core::primitive::u64 = 1 + [
185
186
187
188
189
                        0u64 ,
                        [
                            (
                                (
                                    0u64
190
                                    + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
191
                                )
192
                                + <[u8; 32] as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
193
194
195
196
197
                            ,
                            [
                                (
                                    (
                                        0u64
198
                                        + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
199
                                    )
200
                                    + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
201
202
203
204
205
206
207
208
                                ),
                                0u64
                            ]
                            [
                                (
                                    (
                                        (
                                            0u64
209
                                            + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
210
                                        )
211
                                        + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
212
213
                                    )
                                    < 0u64
214
                                ) as ::core::primitive::usize
215
216
217
218
219
220
                            ]
                        ][
                            (
                                (
                                    (
                                        0u64
221
                                        + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
222
                                    )
223
                                    + <[u8; 32] as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
224
225
226
227
228
                                )
                                <[
                                    (
                                        (
                                            0u64
229
                                            + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
230
                                        )
231
                                        + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
232
233
234
235
236
237
238
                                    ),
                                    0u64
                                ][
                                    (
                                        (
                                            (
                                                0u64
239
                                                + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
240
                                            )
241
                                            + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
242
243
                                        )
                                        < 0u64
244
                                    ) as ::core::primitive::usize
245
                                ]
246
                            ) as ::core::primitive::usize
247
248
249
250
251
252
253
                        ]
                    ][
                        (
                            0u64 <[
                                (
                                    (
                                        0u64
254
                                        + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
255
                                    )
256
                                    + <[u8; 32] as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
257
258
259
260
261
                                ),
                                [
                                    (
                                        (
                                            0u64
262
                                            + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
263
                                        )
264
                                        + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
265
266
267
268
269
270
271
                                    ),
                                    0u64
                                ][
                                    (
                                        (
                                            (
                                                0u64
272
                                                + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
273
                                            )
274
                                            + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
275
276
                                        )
                                        < 0u64
277
                                    ) as ::core::primitive::usize
278
279
280
281
282
283
                                ]
                            ][
                                (
                                    (
                                        (
                                            0u64
284
                                            + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
285
                                        )
286
                                        + <[u8; 32] as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
287
288
289
290
291
                                    )
                                    <[
                                        (
                                            (
                                                0u64
292
                                                + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
293
                                            )
294
                                            + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
295
296
297
298
299
300
301
                                        ),
                                        0u64
                                    ][
                                        (
                                            (
                                                (
                                                    0u64
302
                                                    + <i32 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
303
                                                )
304
                                                + <(bool, i32) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT
305
306
                                            )
                                            < 0u64
307
                                        ) as ::core::primitive::usize
308
                                    ]
309
                                ) as ::core::primitive::usize
310
                            ]
311
                        ) as ::core::primitive::usize
312
313
                    ];

314
                    const REQUIRES_DEEP_CLEAN_UP : ::core::primitive::bool = (
315
316
317
318
319
                        (
                            (false || false)
                            || (
                                (
                                    false
320
                                    || <i32 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
321
                                )
322
                                || <[u8; 32] as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
323
324
325
326
327
                            )
                        )
                        || (
                            (
                                false
328
                                || <i32 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
329
                            )
330
                            || <(bool, i32) as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
331
332
333
                        )
                    );

334
                    fn pull_spread(__key_ptr: &mut ::ink_storage::traits::KeyPtr) -> Self {
335
                        match <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr)
336
337
338
                        {
                            0u8 => MixedEnum::A,
                            1u8 => MixedEnum::B(
339
340
                                <i32 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
                                <[u8; 32] as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
341
342
                            ),
                            2u8 => MixedEnum::C {
343
344
                                a: < i32 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr ),
                                b: <(bool, i32) as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
345
346
347
348
                            },
                            _ => unreachable!("encountered invalid enum discriminant"),
                        }
                    }
349
                    fn push_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
350
351
352
                        match self {
                            MixedEnum::A => {
                                {
353
                                    <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::push_spread(
354
355
356
357
358
359
360
                                        &0u8,
                                        __key_ptr
                                    );
                                }
                            }
                            MixedEnum::B(__binding_0, __binding_1,) => {
                                {
361
                                    <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::push_spread(
362
363
364
365
366
                                        &1u8,
                                        __key_ptr
                                    );
                                }
                                {
367
                                    ::ink_storage::traits::SpreadLayout::push_spread(
368
369
370
371
372
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
373
                                    ::ink_storage::traits::SpreadLayout::push_spread(
374
375
376
377
378
379
380
381
382
383
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                            MixedEnum::C {
                                a: __binding_0,
                                b: __binding_1,
                            } => {
                                {
384
                                    <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::push_spread(
385
386
387
388
                                        &2u8, __key_ptr
                                    );
                                }
                                {
389
                                    ::ink_storage::traits::SpreadLayout::push_spread(
390
391
392
393
394
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
395
                                    ::ink_storage::traits::SpreadLayout::push_spread(
396
397
398
399
400
401
402
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }
403
                    fn clear_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
404
405
406
407
                        match self {
                            MixedEnum::A => {}
                            MixedEnum::B(__binding_0, __binding_1,) => {
                                {
408
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
409
410
411
412
413
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
414
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
415
416
417
418
419
420
421
422
423
424
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                            MixedEnum::C {
                                a: __binding_0,
                                b: __binding_1,
                            } => {
                                {
425
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
426
427
428
429
430
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
431
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }
                }
            };
        }
    }
}

#[test]
fn generic_struct_works() {
    synstructure::test_derive! {
        spread_layout_derive {
            struct GenericStruct<T1, T2> {
                a: T1,
                b: (T1, T2),
            }
        }
        expands to {
455
            const _: () = {
456
                impl<T1, T2> ::ink_storage::traits::SpreadLayout for GenericStruct<T1, T2>
457
                where
458
459
                    T1: ::ink_storage::traits::SpreadLayout,
                    T2: ::ink_storage::traits::SpreadLayout
460
461
                {
                    #[allow(unused_comparisons)]
462
                    const FOOTPRINT: ::core::primitive::u64 = [
463
464
                        ((0u64 + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                            + <(T1, T2) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT),
465
                        0u64
466
467
                    ][(((0u64 + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                        + <(T1, T2) as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
468
                        < 0u64) as ::core::primitive::usize
469
470
                    ];

471
                    const REQUIRES_DEEP_CLEAN_UP : ::core::primitive::bool = (
472
473
474
                        false || (
                            (
                                false
475
                                || <T1 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
476
                            )
477
                            || < (T1, T2) as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
478
479
480
                        )
                    );

481
                    fn pull_spread(__key_ptr: &mut ::ink_storage::traits::KeyPtr) -> Self {
482
                        GenericStruct {
483
                            a: <T1 as ::ink_storage::traits::SpreadLayout>::pull_spread(
484
485
                                __key_ptr
                            ),
486
                            b: <(T1, T2) as ::ink_storage::traits::SpreadLayout>::pull_spread(
487
488
489
490
491
                                __key_ptr
                            ),
                        }
                    }

492
                    fn push_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
493
494
495
496
497
498
                        match self {
                            GenericStruct {
                                a: __binding_0,
                                b: __binding_1,
                            } => {
                                {
499
                                    ::ink_storage::traits::SpreadLayout::push_spread(
500
501
502
503
504
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
505
                                    ::ink_storage::traits::SpreadLayout::push_spread(
506
507
508
509
510
511
512
513
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }

514
                    fn clear_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
515
516
517
518
519
520
                        match self {
                            GenericStruct {
                                a: __binding_0,
                                b: __binding_1,
                            } => {
                                {
521
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
522
523
524
525
526
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
527
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }
                }
            };
        }
    }
}

#[test]
fn generic_enum_works() {
    synstructure::test_derive! {
        spread_layout_derive {
            enum GenericEnum<T1, T2> {
                Tuple(T1, T2),
                Named { a: T1, b: T2 },
            }
        }
        expands to {
551
            const _: () = {
552
                impl<T1, T2> ::ink_storage::traits::SpreadLayout for GenericEnum<T1, T2>
553
                where
554
555
                    T1: ::ink_storage::traits::SpreadLayout,
                    T2: ::ink_storage::traits::SpreadLayout
556
557
                {
                    #[allow(unused_comparisons)]
558
                    const FOOTPRINT: ::core::primitive::u64 = 1 + [
559
560
                        ((0u64 + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                            + <T2 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT),
561
                        [
562
563
                            ((0u64 + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                                + <T2 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT),
564
565
                            0u64
                        ][(((0u64
566
567
                            + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                            + <T2 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
568
                            < 0u64) as ::core::primitive::usize]
569
570
                    ][(((0u64 + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                        + <T2 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
571
                        < [
572
573
                            ((0u64 + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                                + <T2 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT),
574
575
                            0u64
                        ][(((0u64
576
577
                            + <T1 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
                            + <T2 as ::ink_storage::traits::SpreadLayout>::FOOTPRINT)
578
                            < 0u64) as ::core::primitive::usize]) as ::core::primitive::usize
579
580
                    ];

581
                    const REQUIRES_DEEP_CLEAN_UP : ::core::primitive::bool = (
582
583
584
585
                        (
                            false || (
                                (
                                    false
586
                                    || <T1 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
587
                                )
588
                                || <T2 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
589
590
591
592
593
                            )
                        )
                        || (
                            (
                                false
594
                                || <T1 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
595
                            )
596
                            || <T2 as ::ink_storage::traits::SpreadLayout>::REQUIRES_DEEP_CLEAN_UP
597
598
599
                        )
                    );

600
                    fn pull_spread(__key_ptr: &mut ::ink_storage::traits::KeyPtr) -> Self {
601
                        match <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr)
602
603
                        {
                            0u8 => GenericEnum::Tuple(
604
605
                                <T1 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
                                <T2 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
606
607
                            ),
                            1u8 => GenericEnum::Named {
608
609
                                a: <T1 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
                                b: <T2 as ::ink_storage::traits::SpreadLayout>::pull_spread(__key_ptr),
610
611
612
613
614
                            },
                            _ => unreachable!("encountered invalid enum discriminant"),
                        }
                    }

615
                    fn push_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
616
617
618
                        match self {
                            GenericEnum::Tuple(__binding_0, __binding_1,) => {
                                {
619
                                    <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::push_spread(&0u8, __key_ptr);
620
621
                                }
                                {
622
                                    ::ink_storage::traits::SpreadLayout::push_spread(
623
624
625
626
627
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
628
                                    ::ink_storage::traits::SpreadLayout::push_spread(
629
630
631
632
633
634
635
636
637
638
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                            GenericEnum::Named {
                                a: __binding_0,
                                b: __binding_1,
                            } => {
                                {
639
                                    <::core::primitive::u8 as ::ink_storage::traits::SpreadLayout>::push_spread(&1u8, __key_ptr);
640
641
                                }
                                {
642
                                    ::ink_storage::traits::SpreadLayout::push_spread(
643
644
645
646
647
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
648
                                    ::ink_storage::traits::SpreadLayout::push_spread(
649
650
651
652
653
654
655
656
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }

657
                    fn clear_spread(&self, __key_ptr: &mut ::ink_storage::traits::KeyPtr) {
658
659
660
                        match self {
                            GenericEnum::Tuple(__binding_0, __binding_1,) => {
                                {
661
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
662
663
664
665
666
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
667
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
668
669
670
671
672
673
674
675
676
677
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                            GenericEnum::Named {
                                a: __binding_0,
                                b: __binding_1,
                            } => {
                                {
678
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
679
680
681
682
683
                                        __binding_0,
                                        __key_ptr
                                    );
                                }
                                {
684
                                    ::ink_storage::traits::SpreadLayout::clear_spread(
685
686
687
688
689
690
691
692
693
694
695
696
                                        __binding_1,
                                        __key_ptr
                                    );
                                }
                            }
                        }
                    }
                }
            };
        }
    }
}