tuplez 0.14.16

Tuples represented in recursive form
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
#[cfg(feature = "uninit")]
use crate::uninit::*;
#[cfg(feature = "unwrap")]
use crate::unwrap::*;
use crate::{fold::Foldable, foreach::Foreach, macros::*, ops::*, predicate::*, search::*};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "uninit")]
use std::mem::MaybeUninit;
use std::{
    ops::{
        Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div,
        DivAssign, Mul, MulAssign, Neg, Not, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub,
        SubAssign,
    },
    pin::Pin,
};
use tuplez_macros::tuple_traits_impl;

/// The unit type that represents tuples of zero elements.
///
/// Compared with [`Tuple`] type, the unit type does not implement the [`Poppable`] trait.
///
/// Suggestion: Use the parameterless [`tuple!`](crate::tuple!) macro to create a unit:
///
/// ```
/// use tuplez::tuple;
/// let unit = tuple!();
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Unit;

/// The type used to represent tuples containing at least one element.
///
/// See [`Unit`] type which represents tuples containing no elements.
///
/// The [`TupleLike`] trait defines the basic methods of all [`Tuple`] types and [`Unit`] type.
/// Check out [`TupleLike`]'s documentation page to see exactly what APIs are available.
///
/// # Build a tuple
///
/// You can create a tuple quickly and easily using the [`tuple!`](crate::tuple!) macro:
///
/// ```
/// use tuplez::tuple;
/// let tup = tuple!(1, "hello", 3.14);
/// ```
///
/// Use `;` to indicate repeated elements:
///
/// ```
/// use tuplez::tuple;
/// assert_eq!(tuple!(1.0, 2;3, "3"), tuple!(1.0, 2, 2, 2, "3"));
/// ```
///
/// Remember that macros do not directly evaluate expressions, so:
///
/// ```
/// use tuplez::tuple;
///
/// let mut x = 0;
/// assert_eq!(tuple!({x += 1; x}; 3), tuple!(1, 2, 3));
/// ```
///
/// # Representation
///
/// Unlike [primitive tuple types](https://doc.rust-lang.org/std/primitive.tuple.html),
/// [`Tuple`] uses a recursive form of representation:
///
/// ```text
/// Primitive tuple representation:
///     (T0, T1, T2, T3)
/// `Tuple` representation:
///     Tuple<T0, Tuple<T1, Tuple<T2, Tuple<T3, Unit>>>>
/// ```
///
/// ... but don’t worry, in almost all cases [`Tuple`] will not take up more memory:
///
/// ```
/// use std::mem::size_of;
/// use tuplez::{Tuple, Unit};
///
/// assert_eq!(size_of::<(i32, f64, &str)>(),
///     size_of::<Tuple<i32, Tuple<f64, Tuple<&str, Unit>>>>());
/// ```
///
/// The advantage of using the recursive form of representation is that we can implement
/// a variety of methods on tuples of any length, instead of only implementing these methods
/// on tuples of length less than 12 (or 32).
///
/// **As a shorthand, we use `Tuple<T0, T1, ... Tn>` to represent a [`Tuple`] type containing `N+1` elements**
/// **in the following text, please keep in mind that this is not a true [`Tuple`] representation.**
///
/// A [`Tuple`] can also be used as one of the elements of another [`Tuple`], without restriction.
///
/// # Explicit tuple types
///
/// In most cases, `Tuple` or `Tuple<_, _>` is sufficient to meet the syntax requirements:
///
/// ```
/// # #![cfg_attr(feature = "any_array", feature(generic_const_exprs))]
///
/// use tuplez::Tuple;
///
/// let tup = Tuple::from((1, "hello", 3.14)); // or
/// let tup: Tuple<_, _> = From::from((1, "hello", 3.14));
/// ```
///
/// But sometimes, you may still need to annotate the complete tuple type explicitly.
/// At this point, you can use the [`tuple_t!`](crate::tuple_t) macro to generate it:
///
/// ```
/// use tuplez::{tuple, tuple_t};
///
/// let tup: tuple_t!(i32, String, f64) = Default::default();
/// assert_eq!(tup, tuple!(0, String::new(), 0.0));
///
/// let unit: tuple_t!() = Default::default();
/// assert_eq!(unit, tuple!());
///
/// fn use_tuple(tup: tuple_t!(i32, &dyn std::fmt::Debug, tuple_t!(String, String))) {
///     todo!()
/// }
/// ```
///
/// Use `;` to indicate repeated types:
///
/// ```
/// use tuplez::{tuple, tuple_t};
///
/// let tup: tuple_t!(i32, f64;3, i32) = tuple!(1, 2.0, 3.0, 4.0, 5);
/// ```
///
/// Sometimes, you may want to know the exact type of a tuple variable, so that you can call an associated method
/// of this tuple type, such as, [`Default::default()`]. However, the signature of this type can be very long
/// and complex, and you may not want to write it out completely via [`tuple_t!`](crate::tuple_t!).
///
/// Here's a little trick that might help:
///
/// ```
/// use tuplez::tuple;
///
/// fn default_by<T: Default>(_: &T) -> T {
///     T::default()
/// }
///
/// let tup = tuple!([1, 2, 3], tuple!("hello".to_string(), 3.14), 8);
/// let tup2 = default_by(&tup);
/// assert_eq!(tup2, tuple!([0; 3], tuple!(String::new(), 0.0), 0));
/// ```
///
/// # Element access
///
/// There is a [`get!`](crate::get) macro that can be used to get elements,
/// the only restriction is that the index must be an integer literal:
///
/// ```
/// use tuplez::{get, tuple};
///
/// let tup = tuple!(1, "hello", 3.14);
/// assert_eq!(get!(tup; 0), 1);
/// assert_eq!(get!(tup; 1), "hello");
/// assert_eq!(get!(tup; 2), 3.14);
/// ```
///
/// This macro will be expanded to standard member access syntax:
///
/// ```text
/// get!(tup; 0) => tup.0
/// get!(tup; 1) => tup.1.0
/// get!(tup; 2) => tup.1.1.0
/// ```
///
/// ... so, here's an example of modifying elements:
///
/// ```
/// use tuplez::{get, tuple};
///
/// fn add_one(x: &mut i32) { *x += 1; }
///
/// let mut tup = tuple!(1, "hello", 3.14);
/// add_one(&mut get!(tup; 0));
/// assert_eq!(tup, tuple!(2, "hello", 3.14));
/// ```
///
/// # Push, pop, join and split
///
/// Any tuple can push further elements, or join another one, with no length limit.
///
/// ```
/// use tuplez::{tuple, TupleLike};
///
/// let tup = tuple!();
///
/// let tup2 = tup.push(1);             // Push element to back
/// assert_eq!(tup2, tuple!(1));
///
/// let tup3 = tup2.push_back("hello"); // Same as `push`, push element to back
/// assert_eq!(tup3, tuple!(1, "hello"));
///
/// let tup4 = tup3.push_front(3.14);   // Push element to front
/// assert_eq!(tup4, tuple!(3.14, 1, "hello"));
///
/// let tup5 = tup3.join(tup4);         // Join two tuples
/// assert_eq!(tup5, tuple!(1, "hello", 3.14, 1, "hello"));
/// ```
///
/// [`Unit`]s are not [`Poppable`], and all [`Tuple`]s are [`Poppable`]:
///
/// ```
/// use tuplez::{tuple, TupleLike};
///
/// let tup = tuple!(1, "hello", 3.14, [1, 2, 3]);
///
/// let (tup2, arr) = tup.pop();        // Pop element from back
/// assert_eq!(tup2, tuple!(1, "hello", 3.14));
/// assert_eq!(arr, [1, 2, 3]);
///
/// let (tup3, pi) = tup2.pop_back();   // Same as `pop`, pop element from back
/// assert_eq!(tup3, tuple!(1, "hello"));
/// assert_eq!(pi, 3.14);
///
/// let (tup4, num) = tup3.pop_front();  // Pop element from front
/// assert_eq!(tup4, tuple!("hello"));
/// assert_eq!(num, 1);
///
/// let (unit, hello) = tup4.pop();
/// assert_eq!(unit, tuple!());
/// assert_eq!(hello, "hello");
///
/// // _ = unit.pop()                   // Error: cannot pop a `Unit`
/// ```
///
/// The [`take!`](crate::take!) macro can take out an element by its index or type:
///
/// ```
/// use tuplez::{take, tuple};
///
/// let tup = tuple!(1, "hello", 3.14, [1, 2, 3]);
///
/// let (element, remainder) = take!(tup; 2);
/// assert_eq!(element, 3.14);
/// assert_eq!(remainder, tuple!(1, "hello", [1, 2, 3]));
///
/// let (element, remainder) = take!(tup; &str);
/// assert_eq!(element, "hello");
/// assert_eq!(remainder, tuple!(1, 3.14, [1, 2, 3]));
/// ```
///
/// You can use the [`split_at!`](crate::split_at) macro to split a tuple into two parts.
/// Like the [`get!`](crate::get) macro, the index must be an integer literal:
///
/// ```
/// use tuplez::{split_at, tuple};
///
/// let tup = tuple!(1, "hello", 3.14, [1, 2, 3]);
///
/// let (left, right) = split_at!(tup; 2);
/// assert_eq!(left, tuple!(1, "hello"));
/// assert_eq!(right, tuple!(3.14, [1, 2, 3]));
///
/// let (left, right) = split_at!(tup; 0);
/// assert_eq!(left, tuple!());
/// assert_eq!(right, tup);
///
/// let (left, right) = split_at!(tup; 4);
/// assert_eq!(left, tup);
/// assert_eq!(right, tuple!());
/// ```
///
/// # Get subsequences
///
/// You can get a subsequence of a tuple via the [`subseq()`](TupleLike::subseq()) method:
///
/// ```
/// use tuplez::{tuple, TupleLike, tuple_t};
///
/// let tup = tuple!(12, "hello", 24, 3.14, true);
/// let subseq: tuple_t!(&str, bool) = tup.subseq();
/// assert_eq!(subseq, tuple!("hello", true));
///
/// // Two candidates available: `(12, true)` or `(24, true)`.
/// // let subseq: tuple_t!(i32, bool) = tup.subseq();
///
/// // No candidates available.
/// // `(true, "hello")` cannot be a candidate, since its element order is
/// // different from the supersequence.
/// // let subseq: tuple_t!(bool, &str) = tup.subseq();
///
/// // Although `24` is also `i32`, but only `(12, "hello")` is a candidate.
/// let subseq: tuple_t!(i32, &str) = tup.subseq();
/// assert_eq!(subseq, tuple!(12, "hello"));
///
/// // It's OK to pick all `i32`s since there is only one candidate.
/// let subseq: tuple_t!(i32, i32) = tup.subseq();
/// assert_eq!(subseq, tuple!(12, 24));
/// ```
///
/// You can also get a continuous subsequence via the [`con_subseq()`](TupleLike::con_subseq()),
/// it may do somethings that [`subseq()`](TupleLike::subseq) cannot do:
///
/// ```
/// use tuplez::{tuple, TupleLike, tuple_t};
///
/// let tup = tuple!(12, "hello", 24, true, false);
///
/// // For `subseq`, 4 candidates available:
/// //      `(12, true)`,
/// //      `(12, false)`,
/// //      `(24, true)`,
/// //      `(24, false)`,
/// // so this cannot be compiled.
/// // let subseq: tuple_t!(i32, bool) = tup.subseq();
///
/// // But for `con_subseq`,only `(24, true)` is a candidate.
/// let subseq: tuple_t!(i32, bool) = tup.con_subseq();
/// assert_eq!(subseq, tuple!(24, true));
/// ```
///
/// There are also many methods about subsequence: [`subseq_ref()`](TupleLike::subseq_ref()),
/// [`subseq_mut()`](TupleLike::subseq_mut()), [`swap_subseq()`](TupleLike::swap_subseq()),
/// [`replace_subseq()`](TupleLike::replace_subseq()), [`con_subseq_ref()`](TupleLike::con_subseq_ref()),
/// [`con_subseq_mut()`](TupleLike::con_subseq_mut()), [`swap_con_subseq()`](TupleLike::swap_con_subseq()),
/// [`replace_con_subseq()`](TupleLike::replace_con_subseq()).
/// Please refer to their own documentation.
///
/// # Trait implementations on [`Tuple`]
///
/// For `Tuple<T0, T1, ... Tn>`, when all types `T0`, `T1`, ... `Tn` implement the [`Debug`] /
/// [`Clone`] / [`Copy`] / [`PartialEq`] / [`Eq`] / [`PartialOrd`] / [`Ord`] / [`Hash`] / [`Default`] /
/// [`Neg`] / [`Not`] trait(s), then the `Tuple<T0, T1, ... Tn>` also implements it/them.
///
/// For example:
///
/// ```
/// use tuplez::tuple;
///
/// let tup = tuple!(false, true, 26u8);            // All elements implement `Not`
/// assert_eq!(!tup, tuple!(true, false, 229u8));   // So `Tuple` also implements `Not`
/// ```
///
/// For `Tuple<T0, T1, ... Tn>` and `Tuple<U0, U1, ... Un>`, when each `Ti` implements
/// `Trait<Ui>` if the `Trait` is [`Add`] / [`AddAssign`] / [`Sub`] / [`SubAssign`] /
/// [`Mul`] / [`MulAssign`] / [`Div`] / [`DivAssign`] / [`Rem`] / [`RemAssign`] /
/// [`BitAnd`] / [`BitAndAssign`] / [`BitOr`] / [`BitOrAssign`] / [`BitXor`] / [`BitXorAssign`]
/// / [`Shl`] / [`ShlAssign`] / [`Shr`] / [`ShrAssign`],
/// then `Tuple<T0, T1, ... Tn>` also implements `Trait<Tuple<U0, U1, ... Un>>`.
///
/// For example:
///
/// ```
/// use tuplez::tuple;
///
/// let tup1 = tuple!(5, "hello ".to_string());
/// let tup2 = tuple!(4, "world");
/// assert_eq!(tup1 + tup2, tuple!(9, "hello world".to_string()));
/// ```
///
/// If the number of elements on both sides is not equal, then the excess will be retained as is:
///
/// ```
/// use tuplez::tuple;
///
/// let x = tuple!(10, "hello".to_string(), 3.14, vec![1, 2]);
/// let y = tuple!(5, " world");
/// assert_eq!(x + y, tuple!(15, "hello world".to_string(), 3.14, vec![1, 2]));
/// ```
///
/// # Traverse tuples
///
/// You can traverse tuples by [`foreach()`](TupleLike::foreach()).
///
/// Call [`foreach()`](TupleLike::foreach()) on a tuple requires a mapper implementing
/// [`Mapper`](crate::foreach::Mapper) as the parameter. Check its documentation page for examples.
///
/// However, here are two ways you can quickly build a mapper.
///
/// ## Traverse tuples by element types
///
/// The [`mapper!`](crate::mapper!) macro helps you build a mapper that traverses tuples according to their element types.
///
/// For example:
///
/// ```
/// use tuplez::{mapper, tuple, TupleLike};
///
/// let tup = tuple!(1, "hello", 3.14).foreach(mapper! {
///     |x: i32| -> i64 { x as i64 }
///     |x: f32| -> String { x.to_string() }
///     <'a> |x: &'a str| -> &'a [u8] { x.as_bytes() }
/// });
/// assert_eq!(tup, tuple!(1i64, b"hello" as &[u8], "3.14".to_string()));
/// ```
///
/// ## Traverse tuples in order of their elements
///
/// You can create a new tuple with the same number of elements, whose elements are all callable objects that accepts an element
/// and returns another value ([`FnOnce(T) -> U`](std::ops::FnOnce)), then, you can use that tuple as a mapper.
//
/// ```
/// use tuplez::{tuple, TupleLike};
///
/// let tup = tuple!(1, 2, 3);
/// let result = tup.foreach(
///     tuple!(
///         |x| x as f32,
///         |x: i32| x.to_string(),
///         |x: i32| Some(x),
///     )
/// );
/// assert_eq!(result, tuple!(1.0, "2".to_string(), Some(3)));
/// ```
///
/// # Fold tuples
///
/// You can fold tuples by [`fold()`](TupleLike::fold()).
///
/// Call [`fold()`](TupleLike::fold()) on a tuple requires a folder implementing
/// [`Folder`](crate::fold::Folder) as the parameter. Check its documentation page for examples.
///
/// However, here are two ways you can quickly build a folder.
///
/// ## Fold tuples by element types
///
/// The [`folder!`](crate::folder!) macro helps you build a folder that folds tuples according to their element types.
///
/// For example:
///
/// ```
/// use tuplez::{folder, tuple, TupleLike};
///
/// let tup = tuple!(Some(1), "2", Some(3.0));
/// let result = tup.fold(
///     folder! { String; // Type of `acc` of all closures must be the same and annotated at the front
///         |acc, x: &str| { acc + &x.to_string() }
///         <T: ToString> |acc, x: Option<T>| { acc + &x.unwrap().to_string() }
///     },
///     String::new(),
/// );
/// assert_eq!(result, "123".to_string());
/// ```
///
/// ## Fold tuples in order of their elements
///
/// You can create a new tuple with the same number of elements, whose elements are all callable objects that accepts the accumulation value
/// and an element and returns new accumulation value ([`FnOnce(Acc, T) -> Acc`](std::ops::FnOnce)), then, you can use that tuple as a folder.
///
/// For example:
///
/// ```
/// use tuplez::{tuple, TupleLike};
///
/// let tup = tuple!(1, "2", 3.0);
/// let result = tup.fold(
///     tuple!(
///         |acc, x| (acc + x) as f64,
///         |acc: f64, x: &str| acc.to_string() + x,
///         |acc: String, x| acc.parse::<i32>().unwrap() + x as i32,
///     ),  // Type of `acc` of each closure is the return type of the previous closure.
///     0,
/// );
/// assert_eq!(result, 15);
/// ```
///
/// # Convert from/to primitive tuples
///
/// Okay, we're finally talking about the only interfaces of [`Tuple`] that limits the maximum number of elements.
///
/// Since Rust does not have a way to represent [primitive tuple types](https://doc.rust-lang.org/std/primitive.tuple.html) with an arbitrary number of elements,
/// the interfaces for converting from/to primitive tuple types is only implemented for [`Tuple`]s with no more than 32 elements.
///
/// ```
/// # #![cfg_attr(feature = "any_array", feature(generic_const_exprs))]
///
/// use tuplez::{ToPrimitive, tuple, Tuple, tuple_t};
///
/// let tup = tuple!(1, "hello", 3.14);
/// let prim_tup = (1, "hello", 3.14);
/// assert_eq!(tup.primitive(), prim_tup);
/// assert_eq!(tup, Tuple::from(prim_tup));
///
/// let unit = tuple!();
/// let prim_unit = ();
/// assert_eq!(unit.primitive(), prim_unit);
/// assert_eq!(unit, <tuple_t!()>::from(prim_unit));
/// ```
///
/// # Convert from/to primitive arrays
///
/// If all elements of a tuple are of the same type, then it can be converted from/to [primitive arrays](std::array).
///
/// Currently tuples cannot be converted from/to primitive arrays with no limit on the number of elements,
/// since the [generic constant expressions](https://github.com/rust-lang/rust/issues/76560) feature is still unstable yet.
///
/// Therefore, by default only tuples with no more than 32 elements are supported to be converted from/to primitive arrays.
///
/// However, if you are OK with using rustc released to nightly channel to compile codes with unstable features,
/// you can enable the `any_array` feature, then tuplez will use unstable features to implement conversion from/to
/// primitive arrays on tuples of any number of elements.
///
/// ```toml
/// tuplez = { features = [ "any_array" ] }
/// ```
///
/// For examples:
///
/// ```
/// // Enable Rust's `generic_const_exprs` feature if you enable tuplez's `any_array` feature.
/// #![cfg_attr(feature = "any_array", feature(generic_const_exprs))]
///
/// use tuplez::{ToArray, tuple, tuple_t};
///
/// assert_eq!(tuple!(1, 2, 3, 4, 5, 6).to_array(), [1, 2, 3, 4, 5, 6]);
/// assert_eq!(<tuple_t!(i32; 4)>::from([1, 2, 3, 4]), tuple!(1, 2, 3, 4));
///
/// // `Unit` can be converted from/to array of any element type
/// let _ : [i32; 0] = tuple!().to_array();
/// let _ : [String; 0] = tuple!().to_array();
/// let _ = <tuple_t!()>::from([3.14; 0]);
/// let _ = <tuple_t!()>::from([""; 0]);
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Tuple<First, Other>(
    /// First element.
    pub First,
    /// Other elements. See [representation](Tuple#representation).
    pub Other,
);

/// Define the basic methods of tuples.
///
/// NOTE: Due to the limitation that Rust does not support the variadic to represent
/// [primitive tuple types]((https://doc.rust-lang.org/std/primitive.tuple.html)) containing any number of elements,
/// we cannot make [`TupleLike`] trait contain a method that converts tuple to the primitive tuple type.
/// Therefore, this method is provided by the trait [`ToPrimitive`] and is only implemented for tuples with no more than 32 elements.
pub trait TupleLike {
    /// The type of tuple containing immutable references to all elements of the tuple.
    type AsRefOutput<'a>: TupleLike
    where
        Self: 'a;

    /// The type of tuple containing mutable references to all elements of the tuple.
    type AsMutOutput<'a>: TupleLike
    where
        Self: 'a;

    /// The type of tuple containing pointers to all elements of the tuple.
    type AsPtrOutput: TupleLike;

    /// The type of tuple containing mutable pointers to all elements of the tuple.
    type AsMutPtrOutput: TupleLike;

    /// The type of tuple containing [`Pin`]s of immutable references to all elements of the tuple.
    type AsPinRefOutput<'a>: TupleLike
    where
        Self: 'a;

    /// The type of tuple containing [`Pin`]s of mutable references to all elements of the tuple.
    type AsPinMutOutput<'a>: TupleLike
    where
        Self: 'a;

    /// The type of tuple generated by pushing an element to the front of the tuple.
    type PushFrontOutput<T>: TupleLike;

    /// The type of tuple generated by pushing an element to the back of the tuple.
    type PushBackOutput<T>: TupleLike;

    /// The type of tuple generated by reversing the tuple.
    type RevOutput: TupleLike;

    /// The type of tuple generated by joining two tuples.
    type JoinOutput<T>: TupleLike
    where
        T: TupleLike;

    /// The type of tuple after wrapping all elements into [`Option`](std::option::Option).
    type ToSomeOutput: TupleLike;

    /// The type of tuple after wrapping all elements into [`Result`](std::result::Result).
    type ToOkOutput<E>: TupleLike;

    /// The type of tuple after wrapping all elements into [`Tuple`].
    type ToTupleOutput: TupleLike;

    /// The type of tuple after wrapping all elements into [`MaybeUninit`].
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    type Uninit: TupleLike;

    /// The number of elements in the tuple.
    const LEN: usize;

    /// Get the number of elements in the tuple.
    /// MUST always return [`LEN`](TupleLike::LEN).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    /// assert_eq!(tuple!(1, "hello", 3.14).len(), 3);
    /// ```
    fn len(&self) -> usize {
        Self::LEN
    }

    /// Check if tuple is empty.
    ///
    /// Always be `false` if tuple is [`Unit`],
    /// and always be `true` if tuple is [`Tuple`].
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// assert_eq!(tuple!().is_empty(), true);
    /// assert_eq!(tuple!(1, "hello", 3.14).is_empty(), false);
    /// ```
    fn is_empty(&self) -> bool {
        Self::LEN == 0
    }

    /// Creates a “by reference” adapter for this instance.
    ///
    /// It will simply borrow this current tuple.
    fn by_ref(&mut self) -> &mut Self
    where
        Self: Sized,
    {
        self
    }

    /// Convert from `tuple!(x, y, z, ...)` to `tuple!((0, x), (1, y), (2, z), ...)`.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!("hello", Some([1, 2, 3]), tuple!(3.14, 12));
    /// assert_eq!(tup.enumerate(), tuple!(
    ///     (0, "hello"),
    ///     (1, Some([1, 2, 3])),
    ///     (2, tuple!(3.14, 12)),
    /// ));
    /// ```
    fn enumerate(self) -> Self::EnumerateOutput
    where
        Self: Sized + Enumerable,
    {
        Enumerable::enumerate(self, 0)
    }

    /// Take out the searched element, and get the remainder of tuple.
    ///
    /// Add a type annotation to the searched element to let [`take()`](TupleLike::take()) know which one you want.
    ///
    /// **NOTE**: The type of this element must exist only once in the tuple.
    ///
    /// If you want to take out the element at a specific index, see [`take!`](crate::take!).
    ///
    /// If you want to take out the first or last element, see [`pop()`][TupleLike::pop()].
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(3.14, "hello", 5, [1, 2, 3]);
    /// let (value, remainder): (i32, _) = tup.take();      // Add type annotation for `value`
    /// assert_eq!(value, 5);
    /// assert_eq!(remainder, tuple!(3.14, "hello", [1, 2, 3]));
    /// ```
    ///
    /// If you cannot add a type annotation, you can also use the [`take!`](crate::take!) macro:
    ///
    /// ```
    /// use tuplez::{take, tuple};
    ///
    /// let tup = tuple!(3.14, "hello", 5, [1, 2, 3]);
    /// let (value, remainder) = take!(tup; i32);
    /// assert_eq!(value, 5);
    /// assert_eq!(remainder, tuple!(3.14, "hello", [1, 2, 3]));
    /// ```
    fn take<T, I>(self) -> (T, Self::TakeRemainder)
    where
        Self: Search<T, I> + Sized,
    {
        Search::take(self)
    }

    /// Get an immutable reference of the searched element.
    ///
    /// Add a type annotation to the searched element to let [`get_ref()`](TupleLike::get_ref()) know which one you want.
    ///
    /// **NOTE**: The type of this element must exist only once in the tuple.
    ///
    /// If you want to get the element by its index, see [`get!`](crate::get!);
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(3.14, "hello", 5, [1, 2, 3]);
    /// let arr: &[i32; 3] = tup.get_ref();
    /// assert_eq!(arr, &[1, 2, 3]);
    /// ```
    fn get_ref<T, I>(&self) -> &T
    where
        Self: Search<T, I> + Sized,
    {
        Search::get_ref(self)
    }

    /// Get a mutable reference of the searched element.
    ///
    /// Add a type annotation to the searched element to let [`get_mut()`](TupleLike::get_mut()) know which one you want.
    ///
    /// **NOTE**: The type of this element must exist only once in the tuple.
    ///
    /// If you want to get the element by its index, see [`get!`](crate::get!);
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(3.14, "hello", 5, [1, 2, 3]);
    /// let s: &mut &str = tup.get_mut();
    /// *s = "world";
    /// assert_eq!(tup, tuple!(3.14, "world", 5, [1, 2, 3]));
    /// ```
    fn get_mut<T, I>(&mut self) -> &mut T
    where
        Self: Search<T, I> + Sized,
    {
        Search::get_mut(self)
    }

    /// Swap a specific element of the same type with another value.
    ///
    /// **NOTE**: The type of this element must exist only once in the tuple.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(3.14, "hello", 5, [1, 2, 3]);
    /// let mut s = "world";
    /// tup.swap(&mut s);
    /// assert_eq!(tup, tuple!(3.14, "world", 5, [1, 2, 3]));
    /// assert_eq!(s, "hello");
    /// ```
    fn swap<T, I>(&mut self, value: &mut T)
    where
        Self: Search<T, I>,
    {
        Search::swap(self, value)
    }

    /// Replace a specific element of the same type with another value.
    ///
    /// Return the replaced value.
    ///
    /// **NOTE**: The type of this element must exist only once in the tuple.
    ///
    /// Hint: If you don’t want to consume the input tuple, then what you are looking
    /// for might be [`swap()`](TupleLike::swap()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(3.14, "hello", 5, [1, 2, 3]);
    /// let s = tup.replace("world");
    /// assert_eq!(tup, tuple!(3.14, "world", 5, [1, 2, 3]));
    /// assert_eq!(s, "hello");
    /// ```
    fn replace<T, I>(&mut self, value: T) -> T
    where
        Self: Search<T, I>,
    {
        Search::replace(self, value)
    }

    /// Replace a specific element with another value that may be of a different type.
    ///
    /// The new element is generated a the user-defined function.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, 3.14, "hello", Some([1, 2, 3]));
    /// let result = tup.map_replace(|x: f64| x.to_string());
    /// assert_eq!(result, tuple!(1, "3.14".to_string(), "hello", Some([1, 2, 3])))
    /// ```
    fn map_replace<T, U, F, I>(self, f: F) -> Self::MapReplaceOutput<U>
    where
        Self: Search<T, I> + Sized,
        F: FnOnce(T) -> U,
    {
        Search::map_replace(self, f)
    }

    // fn map_replace<T, I>(self, value: T) ->

    /// Take out a subsequence.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// Add a type annotation to the subsequence to let [`subseq()`](TupleLike::subseq()) know.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!(12, "hello", 24, 3.14, true);
    /// let subseq: tuple_t!(&str, bool) = tup.subseq();
    /// assert_eq!(subseq, tuple!("hello", true));
    ///
    /// // Two candidates available: `(12, true)` or `(24, true)`.
    /// // let subseq: tuple_t!(i32, bool) = tup.subseq();
    ///
    /// // No candidates available.
    /// // `(true, "hello")` cannot be a candidate, since its element order is
    /// // different from the supersequence.
    /// // let subseq: tuple_t!(bool, &str) = tup.subseq();
    ///
    /// // Although `24` is also `i32`, but only `(12, "hello")` is a candidate.
    /// let subseq: tuple_t!(i32, &str) = tup.subseq();
    /// assert_eq!(subseq, tuple!(12, "hello"));
    ///
    /// // It's OK to pick all `i32`s since there is only one candidate.
    /// let subseq: tuple_t!(i32, i32) = tup.subseq();
    /// assert_eq!(subseq, tuple!(12, 24));
    /// ```
    fn subseq<Seq, I>(self) -> Seq
    where
        Self: Subseq<Seq, I> + Sized,
        Seq: TupleLike,
    {
        Subseq::subseq(self)
    }

    /// Similar to [`subseq()`](TupleLike::subseq()),
    /// but all its elements are immutable references to the supersequence's elements.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// Rust is almost impossible to infer generic types by the return type annotation,
    /// so you need to call it like:
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!(12, "hello", vec![1, 2, 3], 24, 3.14, true);
    /// let subseq = tup.subseq_ref::<tuple_t!(&'static str, bool), _>();
    /// assert_eq!(subseq, tuple!(&"hello", &true));
    /// ```
    fn subseq_ref<Seq, I>(&self) -> Seq::AsRefOutput<'_>
    where
        Self: Subseq<Seq, I> + Sized,
        Seq: TupleLike,
    {
        Subseq::subseq_ref(self)
    }

    /// Similar to [`subseq()`](TupleLike::subseq()),
    /// but all its elements are mutable references to the supersequence's elements.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// Rust is almost impossible to infer generic types by the return type annotation,
    /// so you need to call it like:
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(12, "hello", vec![1, 2, 3], 24, 3.14, true);
    /// let subseq = tup.subseq_mut::<tuple_t!(&'static str, bool), _>();
    /// *get!(subseq; 0) = "world";
    /// *get!(subseq; 1) = false;
    /// assert_eq!(tup, tuple!(12, "world", vec![1, 2, 3], 24, 3.14, false));
    /// ```
    fn subseq_mut<Seq, I>(&mut self) -> Seq::AsMutOutput<'_>
    where
        Self: Subseq<Seq, I> + Sized,
        Seq: TupleLike,
    {
        Subseq::subseq_mut(self)
    }

    /// Swap elements with a subsequence.
    ///
    /// See [`subseq()`](TupleLike::subseq()) to see which inputs are subsequence.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(1, Some("hello"), 2, Some(()), 3.14, 3);
    /// let mut tup2 = tuple!(Some("world"), 9.8);
    /// tup.swap_subseq(&mut tup2);
    /// assert_eq!(tup, tuple!(1, Some("world"), 2, Some(()), 9.8, 3));
    /// assert_eq!(tup2, tuple!(Some("hello"), 3.14));
    /// ```
    fn swap_subseq<Seq, I>(&mut self, subseq: &mut Seq)
    where
        Seq: TupleLike,
        Self: Subseq<Seq, I>,
    {
        Subseq::swap_subseq(self, subseq)
    }

    /// Replace elements with a subsequence.
    ///
    /// See [`subseq()`](TupleLike::subseq()) to see which inputs are subsequence.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// It returns a subsequence consisting of the replaced elements.
    ///
    /// Hint: If you don't want to consume the input tuple,
    /// then what you are looking for might be [`swap_subseq()`](TupleLike::swap_subseq()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(1, Some("hello"), 2, Some(()), 3.14, 3);
    /// let replaced = tup.replace_subseq(tuple!(Some("world"), 9.8));
    /// assert_eq!(tup, tuple!(1, Some("world"), 2, Some(()), 9.8, 3));
    /// assert_eq!(replaced, tuple!(Some("hello"), 3.14));
    /// ```
    fn replace_subseq<Seq, I>(&mut self, subseq: Seq) -> Seq
    where
        Seq: TupleLike,
        Self: Subseq<Seq, I>,
    {
        Subseq::replace_subseq(self, subseq)
    }

    /// Replace elements of specific subsequence with another sequence
    /// that may be of different element types.
    ///
    /// The elements of new sequence is generated from the user-defined mapper.
    ///
    /// Check out [`Mapper`](crate::foreach::Mapper)’s documentation page to learn how to build a mapper.
    ///
    /// # Example
    ///
    /// ```
    /// use std::fmt::Debug;
    /// use tuplez::{mapper, tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!(1, 3.14, "hello", [1, 2, 3]);
    /// let result = tup.map_replace_subseq::<tuple_t!(f64, [i32; 3]), _, _>(mapper! {
    ///     |x: f64| -> i32 { x as i32 }
    ///     <T: Debug, const N: usize> |x: [T; N]| -> String { format!("{x:?}") }
    /// });
    /// assert_eq!(result, tuple!(1, 3, "hello", "[1, 2, 3]".to_string()))
    /// ```
    fn map_replace_subseq<Seq, F, I>(self, f: F) -> Self::MapReplaceOutput
    where
        Seq: TupleLike,
        Self: SubseqMapReplace<Seq, F, I> + Sized,
    {
        SubseqMapReplace::map_replace_subseq(self, f)
    }

    /// Replace elements of specific subsequence with another sequence
    /// that may be of different element types.
    ///
    /// Same as [`map_replace_subseq()`](TupleLike::map_replace_subseq()).
    fn foreach_subseq<Seq, F, I>(self, f: F) -> Self::MapReplaceOutput
    where
        Seq: TupleLike,
        Self: SubseqMapReplace<Seq, F, I> + Sized,
    {
        SubseqMapReplace::map_replace_subseq(self, f)
    }

    /// Take out a contiguous subsequence.
    ///
    /// Unlike [`subseq()`](TupleLike::subseq()), this method requires that all elements of the subsequence are
    /// contiguous in the supersequence. Sometimes it can do things that [`subseq()`](TupleLike::subseq()) can't.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// Add a type annotation to the contiguous subsequence to let [`con_subseq()`](TupleLike::con_subseq()) know.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!(12, "hello", 24, true, false);
    ///
    /// // For `subseq`, 4 candidates available:
    /// //      `(12, true)`,
    /// //      `(12, false)`,
    /// //      `(24, true)`,
    /// //      `(24, false)`,
    /// // so this cannot be compiled.
    /// // let subseq: tuple_t!(i32, bool) = tup.subseq();
    ///
    /// // But for `con_subseq`,only `(24, true)` is a candidate.
    /// let subseq: tuple_t!(i32, bool) = tup.con_subseq();
    /// assert_eq!(subseq, tuple!(24, true));
    /// ```
    fn con_subseq<Seq, I>(self) -> Seq
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I> + Sized,
    {
        ConSubseq::con_subseq(self)
    }

    /// Similar to [`con_subseq()`](TupleLike::con_subseq()),
    /// but all its elements are immutable references to the supersequence's elements.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// Rust is almost impossible to infer generic types by the return type annotation,
    /// so you need to call it like:
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!(12, "hello", vec![1, 2, 3], 24, 3.14, 36);
    /// let subseq = tup.con_subseq_ref::<tuple_t!(i32, f32), _>();
    /// assert_eq!(subseq, tuple!(&24, &3.14));
    /// ```
    fn con_subseq_ref<Seq, I>(&self) -> Seq::AsRefOutput<'_>
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I>,
    {
        ConSubseq::con_subseq_ref(self)
    }

    /// Similar to [`con_subseq()`](TupleLike::con_subseq()),
    /// but all its elements are mutable references to the supersequence's elements.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// Rust is almost impossible to infer generic types by the return type annotation,
    /// so you need to call it like:
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(12, "hello", vec![1, 2, 3], "world", 24, 36);
    /// let subseq = tup.con_subseq_mut::<tuple_t!(&'static str, i32), _>();
    /// *get!(subseq; 0) = "rust";
    /// *get!(subseq; 1) = 0;
    /// assert_eq!(tup, tuple!(12, "hello", vec![1, 2, 3], "rust", 0, 36));
    /// ```
    fn con_subseq_mut<Seq, I>(&mut self) -> Seq::AsMutOutput<'_>
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I>,
    {
        ConSubseq::con_subseq_mut(self)
    }

    /// Swap elements with a contiguous subsequence.
    ///
    /// Unlike [`swap_subseq()`](TupleLike::swap_subseq()), this method requires that all
    /// elements of the subsequence are contiguous in the supersequence.
    /// Sometimes it can do things that [`swap_subseq()`](TupleLike::swap_subseq()) can't.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(1, Some("hello"), 2, Some(()), 3.14, 3);
    /// let mut tup2 = tuple!(4, None::<()>);
    /// tup.swap_con_subseq(&mut tup2);
    /// assert_eq!(tup, tuple!(1, Some("hello"), 4, None::<()>, 3.14, 3));
    /// assert_eq!(tup2, tuple!(2, Some(())));
    /// ```
    fn swap_con_subseq<Seq, I>(&mut self, subseq: &mut Seq)
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I>,
    {
        ConSubseq::swap_con_subseq(self, subseq)
    }

    /// Replace elements with a contiguous subsequence.
    ///
    /// Unlike [`replace_subseq()`](TupleLike::replace_subseq()), this method requires that
    /// all elements of the subsequence are contiguous in the supersequence.
    /// Sometimes it can do things that [`replace_subseq()`](TupleLike::replace_subseq()) can't.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// It returns a contiguous subsequence consisting of the replaced elements.
    ///
    /// Hint: If you don't want to consume the input tuple,
    /// then what you are looking for might be [`swap_con_subseq()`](TupleLike::swap_con_subseq()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut tup = tuple!(1, Some("hello"), 2, Some(()), 3.14, 3);
    /// let replaced = tup.replace_con_subseq(tuple!(4, None::<()>));
    /// assert_eq!(tup, tuple!(1, Some("hello"), 4, None::<()>, 3.14, 3));
    /// assert_eq!(replaced, tuple!(2, Some(())));
    /// ```
    fn replace_con_subseq<Seq, I>(&mut self, subseq: Seq) -> Seq
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I>,
    {
        ConSubseq::replace_con_subseq(self, subseq)
    }

    /// Replace elements of specific contiguous subsequence with another sequence
    /// that may be of different element types.
    ///
    /// The elements of new sequence is generated from the user-defined mapper.
    ///
    /// Check out [`Mapper`](crate::foreach::Mapper)’s documentation page to learn how to build a mapper.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{mapper, tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!("1", "2", "3", true, false, true);
    /// let result = tup.map_replace_con_subseq::<tuple_t!(&str, bool, bool), _, _>(mapper! {
    ///     |x: &str| -> i32 { x.parse().unwrap() }
    ///     |x: bool| -> bool { !x }
    /// });
    /// assert_eq!(result, tuple!("1", "2", 3, false, true, true));
    /// ```
    fn map_replace_con_subseq<Seq, F, I>(self, f: F) -> Self::MapReplaceOutput
    where
        Seq: TupleLike,
        Self: ConSubseqMapReplace<Seq, F, I> + Sized,
    {
        ConSubseqMapReplace::map_replace_con_subseq(self, f)
    }

    /// Replace elements of specific contiguous subsequence with another sequence
    /// that may be of different element types.
    ///
    /// Same as [`map_replace_con_subseq()`](TupleLike::map_replace_con_subseq()).
    fn foreach_con_subseq<Seq, F, I>(self, f: F) -> Self::MapReplaceOutput
    where
        Seq: TupleLike,
        Self: ConSubseqMapReplace<Seq, F, I> + Sized,
    {
        ConSubseqMapReplace::map_replace_con_subseq(self, f)
    }

    /// In the past it was used for the functionality of [`subseq()`](TupleLike::subseq()),
    /// however it did not live up to its name: you actually got a subsequence not a subset while
    /// subsets are not required to maintain a consistent element order as the superset.
    ///
    /// Therefore, it has been deprecated. You can use [`subseq()`](TupleLike::subseq()) or
    /// [`con_subseq()`](TupleLike::con_subseq()) instead.
    #[deprecated(since = "0.10.0", note = "Use subseq() or con_subseq() instead")]
    fn subset<Seq, I>(self) -> Seq
    where
        Self: Subseq<Seq, I> + Sized,
        Seq: TupleLike,
    {
        Subseq::subseq(self)
    }

    /// In the past it was used for the functionality of [`subseq_ref()`](TupleLike::subseq_ref()),
    /// however it did not live up to its name: you actually got a subsequence not a subset while
    /// subsets are not required to maintain a consistent element order as the superset.
    ///
    /// Therefore, it has been deprecated. You can use [`subseq_ref()`](TupleLike::subseq_ref()) or
    /// [`con_subseq_ref()`](TupleLike::con_subseq_ref()) instead.
    #[deprecated(
        since = "0.10.0",
        note = "Use subseq_ref() or con_subseq_ref() instead"
    )]
    fn subset_ref<Seq, I>(&self) -> Seq::AsRefOutput<'_>
    where
        Self: Subseq<Seq, I> + Sized,
        Seq: TupleLike,
    {
        Subseq::subseq_ref(self)
    }

    /// In the past it was used for the functionality of [`subseq_mut()`](TupleLike::subseq_mut()),
    /// however it did not live up to its name: you actually got a subsequence not a subset while
    /// subsets are not required to maintain a consistent element order as the superset.
    ///
    /// Therefore, it has been deprecated. You can use [`subseq_mut()`](TupleLike::subseq_mut()) or
    /// [`con_subseq_mut()`](TupleLike::con_subseq_mut()) instead.
    #[deprecated(
        since = "0.10.0",
        note = "Use subseq_mut() or con_subseq_mut() instead"
    )]
    fn subset_mut<Seq, I>(&mut self) -> Seq::AsMutOutput<'_>
    where
        Self: Subseq<Seq, I> + Sized,
        Seq: TupleLike,
    {
        Subseq::subseq_mut(self)
    }

    /// In the past it was used for the functionality of
    /// [`swap_con_subseq()`](TupleLike::swap_con_subseq()),
    /// but with the addition of [`swap_subseq()`](TupleLike::swap_subseq()),
    /// the functionality of this method becomes very unclear.
    ///
    /// Therefore, it has been deprecated. You can use [`swap()`](TupleLike::swap()),
    /// [`swap_subseq()`](TupleLike::swap_subseq()) or
    /// [`swap_con_subseq()`](TupleLike::swap_con_subseq()) instead.
    #[deprecated(
        since = "0.10.0",
        note = "Use swap(), swap_subseq() or swap_con_subseq() instead"
    )]
    fn swap_with<Seq, I>(&mut self, subseq: &mut Seq)
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I>,
    {
        ConSubseq::swap_con_subseq(self, subseq)
    }

    /// In the past it was used for the functionality of
    /// [`replace_con_subseq()`](TupleLike::replace_con_subseq()),
    /// but with the addition of [`replace_subseq()`](TupleLike::replace_subseq()),
    /// the functionality of this method becomes very unclear.
    ///
    /// Therefore, it has been deprecated. You can use [`replace()`](TupleLike::replace()),
    /// [`replace_subseq()`](TupleLike::replace_subseq()) or
    /// [`replace_con_subseq()`](TupleLike::replace_con_subseq()) instead.
    #[deprecated(
        since = "0.10.0",
        note = "Use replace(), replace_subseq() or replace_con_subseq() instead"
    )]
    fn replace_with<Seq, I>(&mut self, subseq: Seq) -> Seq
    where
        Seq: TupleLike,
        Self: ConSubseq<Seq, I>,
    {
        ConSubseq::replace_con_subseq(self, subseq)
    }

    /// Generate a tuple containing immutable references to all elements of the tuple.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let tup = tuple!([1, 2], "hello".to_string());
    /// let tup_ref: tuple_t!(&[i32; 2], &String) = tup.as_ref();
    /// assert_eq!(tup_ref, tuple!(&[1, 2], &String::from("hello")));
    /// ```
    fn as_ref(&self) -> Self::AsRefOutput<'_>;

    /// Generate a tuple containing mutable reference to all elements of the tuple.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike};
    ///
    /// let mut tup = tuple!(1, "hello");
    /// let tup_mut = tup.as_mut();
    /// *get!(tup_mut; 0) += 1;
    /// *get!(tup_mut; 1) = "world";
    /// assert_eq!(tup, tuple!(2, "world"));
    /// ```
    fn as_mut(&mut self) -> Self::AsMutOutput<'_>;

    /// Generate a tuple containing pointers to all elements of the tuple.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike};
    ///
    /// let tup = tuple!(1, 3.14, "hello", vec![1, 2, 3]);
    /// let tup_ptr = tup.as_ptr();
    /// let pi = unsafe { &*get!(tup_ptr; 1) };
    /// assert_eq!(pi, &3.14);
    /// ```
    fn as_ptr(&self) -> Self::AsPtrOutput;

    /// Generate a tuple containing mutable pointers to all elements of the tuple.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike};
    ///
    /// let mut tup = tuple!(1, 3.14, "hello", vec![1, 2, 3]);
    /// let tup_ptr = tup.as_mut_ptr();
    /// let v = unsafe { &mut *get!(tup_ptr; 3) };
    /// v.push(4);
    /// assert_eq!(v.len(), 4);
    /// ```
    fn as_mut_ptr(&mut self) -> Self::AsMutPtrOutput;

    /// Convert from [`Pin<&Tuple<T0, T1, T2, ..>`](Pin) to `Tuple<Pin<&T0>, Pin<&T1>, Pin<&T2>, ...>`.
    fn as_pin_ref(self: Pin<&Self>) -> Self::AsPinRefOutput<'_>;

    /// Convert from [`Pin<&mut Tuple<T0, T1, T2, ..>`](Pin) to `Tuple<Pin<&mut T0>, Pin<&mut T1>, Pin<&mut T2>, ...>`.
    fn as_pin_mut(self: Pin<&mut Self>) -> Self::AsPinMutOutput<'_>;

    /// Convert from `&Tuple<T0, T1, T2, ...>` to `Tuple<&T0::Target, &T1::Target, &T2::Target, ..>`
    /// while all the elements of the tuple implement [`Deref`](std::ops::Deref).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(String::from("hello"), Box::new(12), vec![1, 2, 3]);
    /// assert_eq!(tup.as_deref(), tuple!("hello", &12, &[1, 2, 3] as &[_]));
    /// ```
    fn as_deref(&self) -> Self::AsDerefOutput<'_>
    where
        Self: AsDeref,
    {
        AsDeref::as_deref(self)
    }

    /// Convert from `&mut Tuple<T0, T1, T2, ...>` to `Tuple<&mut T0::Target, &mut T1::Target, &mut T2::Target, ..>`
    /// while all the elements of the tuple implement [`DerefMut`](std::ops::DerefMut).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(String::from("hello"), Box::new(12), vec![1, 2, 3]);
    /// let _: tuple_t!(&mut str, &mut i32, &mut [i32]) = tup.as_deref_mut();
    /// ```
    fn as_deref_mut(&mut self) -> Self::AsDerefMutOutput<'_>
    where
        Self: AsDerefMut,
    {
        AsDerefMut::as_deref_mut(self)
    }

    /// If the elements of the tuple are all references, clone its elements to a new tuple.
    ///
    /// # Example:
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut string = String::from("hello");
    /// let tup = tuple!(&1, &mut string, &3.14);
    /// assert_eq!(tup.cloned(), tuple!(1, String::from("hello"), 3.14));
    /// ```
    fn cloned(&self) -> Self::ClonedOutput
    where
        Self: Cloned,
    {
        Cloned::cloned(self)
    }

    /// If the elements of the tuple are all references, copy its elements to a new tuple.
    ///
    /// # Example:
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut ch = 'c';
    /// let tup = tuple!(&1, &mut ch, &3.14);
    /// assert_eq!(tup.copied(), tuple!(1, 'c', 3.14));
    /// ```
    fn copied(&self) -> Self::CopiedOutput
    where
        Self: Copied,
    {
        Copied::copied(self)
    }

    /// If the elements of the tuple are all references, clone its elements to a new tuple.
    ///
    /// Much like [`cloned()`](TupleLike::cloned()), but can work on types like `&str` or slices.
    ///
    /// # Example:
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let mut arr = [1, 2, 3];
    /// let tup = tuple!(&1, &mut arr as &mut [i32], "hello");
    /// assert_eq!(tup.owned(), tuple!(1, vec![1, 2, 3], "hello".to_string()));
    /// ```
    #[cfg(any(feature = "std", feature = "alloc"))]
    #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
    fn owned(&self) -> Self::OwnedOutput
    where
        Self: Owned,
    {
        Owned::owned(self)
    }

    /// Push an element to the back of the tuple.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// let tup2 = tup.push(44);
    /// assert_eq!(tup2, tuple!(1, "hello", 3.14, 44));
    /// ```
    fn push<T>(self, value: T) -> Self::PushBackOutput<T>;

    /// Push an element to the front of the tuple.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// let tup2 = tup.push_front(44);
    /// assert_eq!(tup2, tuple!(44, 1, "hello", 3.14));
    /// ```
    fn push_front<T>(self, value: T) -> Self::PushFrontOutput<T>;

    /// Push an element to the back of the tuple. Same as [`push()`](TupleLike::push()).
    fn push_back<T>(self, value: T) -> Self::PushBackOutput<T>;

    /// Pop an element from the back of the tuple.
    ///
    /// Note: The [`Unit`] type is not [`Poppable`].
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// let (tup2, popped) = tup.pop();
    /// assert_eq!(tup2, tuple!(1, "hello"));
    /// assert_eq!(popped, 3.14);
    /// ```
    fn pop(self) -> (Self::PopBackOutput, Self::PopBackElement)
    where
        Self: Poppable + Sized,
    {
        Poppable::pop(self)
    }

    /// Pop an element from the front of the tuple.
    ///
    /// Note: The [`Unit`] type is not [`Poppable`].
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// let (tup2, popped) = tup.pop_front();
    /// assert_eq!(tup2, tuple!("hello", 3.14));
    /// assert_eq!(popped, 1);
    /// ```
    fn pop_front(self) -> (Self::PopFrontOutput, Self::PopFrontElement)
    where
        Self: Poppable + Sized,
    {
        Poppable::pop_front(self)
    }

    /// Pop an element from the back of the tuple. Same as [`pop()`](TupleLike::pop()).
    ///
    /// Note: The [`Unit`] type is not [`Poppable`].
    fn pop_back(self) -> (Self::PopBackOutput, Self::PopBackElement)
    where
        Self: Poppable + Sized,
    {
        Poppable::pop_back(self)
    }

    /// Left rotates the elements of the tuple.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "2", 3.0, 4);
    /// let tup2 = tup.rot_l();
    /// assert_eq!(tup2, tuple!("2", 3.0, 4, 1));
    /// ```
    fn rot_l(self) -> Self::RotLeftOutput
    where
        Self: Rotatable + Sized,
    {
        Rotatable::rot_l(self)
    }

    /// Right rotates the elements of the tuple.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "2", 3.0, 4);
    /// let tup2 = tup.rot_r();
    /// assert_eq!(tup2, tuple!(4, 1, "2", 3.0));
    /// ```
    fn rot_r(self) -> Self::RotRightOutput
    where
        Self: Rotatable + Sized,
    {
        Rotatable::rot_r(self)
    }

    /// Reverse elements of the tuple.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// let tup2 = tup.rev();
    /// assert_eq!(tup2, tuple!(3.14, "hello", 1));
    /// ```
    fn rev(self) -> Self::RevOutput;

    /// Join two tuples.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// let tup2 = tuple!(44, "world");
    /// let tup3 = tup.join(tup2);
    /// assert_eq!(tup3, tuple!(1, "hello", 3.14, 44, "world"));
    /// ```
    fn join<T>(self, value: T) -> Self::JoinOutput<T>
    where
        T: TupleLike;

    /// Convert from `tuple!(a, b, c ...)` to `tuple!(Some(a), Some(b), Some(c) ...)`.
    ///
    /// See [`unwrap()`](TupleLike::unwrap()),
    /// [`unwrap_or_default()`](TupleLike::unwrap_or_default())
    /// or [`try_unwrap()`](TupleLike::try_unwrap()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// assert_eq!(tup.to_some(), tuple!(Some(1), Some("hello"), Some(3.14)));
    /// ```
    fn to_some(self) -> Self::ToSomeOutput;

    /// Convert from `tuple!(a, b, c ...)` to `tuple!(Ok(a), Ok(b), Ok(c) ...)`.
    ///
    /// Note: You need to provide the error type.
    ///
    /// See [`unwrap()`](TupleLike::unwrap()),
    /// [`unwrap_or_default()`](TupleLike::unwrap_or_default())
    /// or [`try_unwrap()`](TupleLike::try_unwrap()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// assert_eq!(tup.to_ok::<()>(), tuple!(Ok(1), Ok("hello"), Ok(3.14)));
    /// ```
    fn to_ok<E>(self) -> Self::ToOkOutput<E>;

    /// Convert from `tuple!(a, b, c ...)` to `tuple!(tuple!(a), tuple!(b), tuple!(c) ...)`.
    ///
    /// See [`untuple()`](TupleLike::untuple()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14);
    /// assert_eq!(tup.to_tuple(), tuple!(tuple!(1), tuple!("hello"), tuple!(3.14)));
    /// ```
    fn to_tuple(self) -> Self::ToTupleOutput;

    /// Create a new tuple that all elements are wrapped by [`MaybeUninit`](std::mem::MaybeUninit)
    /// and in uninitialized states.
    ///
    /// Similar to [`MaybeUninit::uninit()`](std::mem::MaybeUninit::uninit()), dropping a tuple with uninitialized elements
    /// will never call elements' drop codes. It is your responsibility to make sure elements get dropped if they got initialized.
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{TupleLike, tuple_t};
    ///
    /// let uninit = <tuple_t!(i32, &str, Vec<String>)>::uninit();
    /// let _: tuple_t!(MaybeUninit<i32>, MaybeUninit<&str>, MaybeUninit<Vec<String>>) = uninit;
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit() -> Self::Uninit;

    /// Create a new tuple that all elements are wrapped by [`MaybeUninit`](std::mem::MaybeUninit)
    /// and in uninitialized states, with the memory being filled with `0` bytes.
    ///
    /// Similar to [`MaybeUninit::zeroed()`](std::mem::MaybeUninit::zeroed()), dropping a tuple with uninitialized elements
    /// will never call elements' drop codes. It is your responsibility to make sure elements get dropped if they got initialized.
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let uninit = <tuple_t!(i32, bool, *const u8)>::zeroed();
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(0, false, std::ptr::null()));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn zeroed() -> Self::Uninit;

    /// Convert from `tuple!(a, b, c ...)` to `tuple!(MaybeUninit::new(a), MaybeUninit::new(b), MaybeUninit::new(c) ...)`.
    ///
    /// See [`uninit_assume_init()`](TupleLike::uninit_assume_init()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let uninit = tuple!(1, "hello", 3.14).to_uninit();
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(1, "hello", 3.14));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn to_uninit(self) -> Self::Uninit;

    /// Extract the values of a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init()`](std::mem::MaybeUninit::assume_init()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, bool, &str)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(true);
    /// uninit.uninit_write_one("hello");
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(12, true, "hello"));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init(self) -> Self::Initialized
    where
        Self: Uninit + Sized,
    {
        Uninit::assume_init(self)
    }

    /// Extract value from a specific [`MaybeUninit`](std::mem::MaybeUninit) element.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init()`](std::mem::MaybeUninit::assume_init()).
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, bool, &str)>::uninit();
    /// uninit.uninit_write_one(12);
    /// let first_init = unsafe { uninit.uninit_assume_init_one::<i32, _>() };
    /// assert_eq!(get!(first_init; 0), 12);
    /// let _: tuple_t!(i32, MaybeUninit<bool>, MaybeUninit<&str>) = first_init;
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_one<T, I>(self) -> Self::MapReplaceOutput<T>
    where
        Self: Search<MaybeUninit<T>, I> + Sized,
    {
        Search::map_replace(self, |x| x.assume_init())
    }

    /// Read the values of a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_read()`](std::mem::MaybeUninit::assume_init_read()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, Option<Vec<u32>>)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(None);
    /// let tup1 = unsafe { uninit.uninit_assume_init_read() };
    /// // SAFETY: `i32` implements `Copy`, duplicating a `None` value is safe.
    /// let tup2 = unsafe { uninit.uninit_assume_init_read() };
    /// assert_eq!(tup1, tup2);
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_read(&self) -> Self::Initialized
    where
        Self: Uninit,
    {
        Uninit::assume_init_read(self)
    }

    /// Read one value from a specific [`MaybeUninit`] element.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_read()`](std::mem::MaybeUninit::assume_init_read()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(
    ///     0,
    ///     MaybeUninit::<i32>::new(12),
    ///     "hello",
    ///     MaybeUninit::<f64>::uninit(),
    ///     24
    /// );
    /// let x: i32 = unsafe { tup.uninit_assume_init_read_one() };
    /// assert_eq!(x, 12);
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_read_one<T, I>(&self) -> T
    where
        Self: Search<MaybeUninit<T>, I>,
    {
        Search::get_ref(self).assume_init_read()
    }

    /// Get immutable references to values of a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_ref()`](std::mem::MaybeUninit::assume_init_ref()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, Vec<i32>)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(vec![1, 2, 3]);
    /// let tup_ref = unsafe { uninit.uninit_assume_init_ref() };
    /// assert_eq!(get!(tup_ref; 0), &12);
    /// assert_eq!(get!(tup_ref; 1), &vec![1, 2, 3]);
    /// unsafe { uninit.uninit_assume_init_drop(); }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_ref(&self) -> <Self::Initialized as TupleLike>::AsRefOutput<'_>
    where
        Self: Uninit,
    {
        Uninit::assume_init_ref(self)
    }

    /// Get immutable reference to value of a specific [`MaybeUninit`](std::mem::MaybeUninit) element.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_ref()`](std::mem::MaybeUninit::assume_init_ref()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(MaybeUninit::<Vec<i32>>::uninit(), "hello", 12);
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let v = unsafe { tup.uninit_assume_init_ref_one::<Vec<i32>, _>() };
    /// assert_eq!(v, &vec![1, 2, 3]);
    /// unsafe { tup.uninit_assume_init_drop_one::<Vec<i32>, _>(); }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_ref_one<T, I>(&self) -> &T
    where
        Self: Search<MaybeUninit<T>, I>,
    {
        Search::get_ref(self).assume_init_ref()
    }

    /// Get mutable references to values of a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_mut()`](std::mem::MaybeUninit::assume_init_mut()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, Vec<i32>)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(vec![1, 2, 3]);
    /// let tup_mut = unsafe { uninit.uninit_assume_init_mut() };
    /// *get!(tup_mut; 0) += 1;
    /// get!(tup_mut; 1).push(4);
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(13, vec![1, 2, 3, 4]));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_mut(&mut self) -> <Self::Initialized as TupleLike>::AsMutOutput<'_>
    where
        Self: Uninit,
    {
        Uninit::assume_init_mut(self)
    }

    /// Get mutable reference to value of a specific [`MaybeUninit`](std::mem::MaybeUninit) element.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_mut()`](std::mem::MaybeUninit::assume_init_mut()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(MaybeUninit::<Vec<i32>>::uninit(), "hello", 12);
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let v = unsafe { tup.uninit_assume_init_mut_one::<Vec<i32>, _>() };
    /// v.push(4);
    /// assert_eq!(v, &vec![1, 2, 3, 4]);
    /// unsafe { tup.uninit_assume_init_drop_one::<Vec<i32>, _>(); }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_mut_one<T, I>(&mut self) -> &mut T
    where
        Self: Search<MaybeUninit<T>, I>,
    {
        Search::get_mut(self).assume_init_mut()
    }

    /// Drop values in place for a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_drop()`](std::mem::MaybeUninit::assume_init_drop()).
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_drop(&mut self)
    where
        Self: Uninit,
    {
        Uninit::assume_init_drop(self)
    }

    /// Drop value in place for a specific [`MaybeUninit`](std::mem::MaybeUninit) element.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_drop()`](std::mem::MaybeUninit::assume_init_drop()).
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_drop_one<T, I>(&mut self)
    where
        Self: Search<MaybeUninit<T>, I>,
    {
        Search::get_mut(self).assume_init_drop()
    }

    /// Get points to values of a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, Vec<i32>)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(vec![1, 2, 3]);
    /// let v = unsafe { &*get!(uninit.uninit_as_ptr(); 1) };
    /// assert_eq!(v.len(), 3);
    /// unsafe { uninit.uninit_assume_init_drop(); }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_as_ptr(&self) -> <Self::Initialized as TupleLike>::AsPtrOutput
    where
        Self: Uninit,
    {
        Uninit::as_ptr(self)
    }

    /// Get mutable points to values of a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{get, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, Vec<i32>)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(vec![1, 2, 3]);
    /// let v = unsafe { &mut *get!(uninit.uninit_as_mut_ptr(); 1) };
    /// v.push(4);
    /// assert_eq!(v.len(), 4);
    /// unsafe { uninit.uninit_assume_init_drop(); }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_as_mut_ptr(&mut self) -> <Self::Initialized as TupleLike>::AsMutPtrOutput
    where
        Self: Uninit,
    {
        Uninit::as_mut_ptr(self)
    }

    /// Set value to a specific [`MaybeUninit`](std::mem::MaybeUninit) element in a tuple.
    ///
    /// **NOTE**: The type of this element must exist only once in the tuple.
    ///
    /// Similar to [`MaybeUninit::write()`](std::mem::MaybeUninit::write()),
    /// this overwrites any previous value without dropping it.
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, bool, &str)>::uninit();
    /// uninit.uninit_write_one(12);
    /// uninit.uninit_write_one(true);
    /// uninit.uninit_write_one("hello");
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(12, true, "hello"));
    ///
    /// let mut tup = tuple!(
    ///     0,
    ///     MaybeUninit::<i32>::uninit(),
    ///     "hello",
    ///     MaybeUninit::<f64>::uninit(),
    ///     24
    /// );
    /// let x = unsafe { tup.uninit_write_one(12) };
    /// assert_eq!(x, &12);
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_write_one<T, I>(&mut self, value: T) -> &mut T
    where
        Self: Search<MaybeUninit<T>, I>,
    {
        Search::get_mut(self).write(value)
    }

    /// Set values to a tuple consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// Similar to [`MaybeUninit::write()`](std::mem::MaybeUninit::write()),
    /// this overwrites any previous value without dropping it.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, bool, &str)>::uninit();
    /// uninit.uninit_write(tuple!(12, true, "hello"));
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(12, true, "hello"));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_write(
        &mut self,
        init: Self::Initialized,
    ) -> <Self::Initialized as TupleLike>::AsMutOutput<'_>
    where
        Self: Uninit,
    {
        Uninit::write(self, init)
    }

    /// Extract values of a specific subsequence consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init()`](MaybeUninit::assume_init()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<&str>::uninit(),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let part_init = unsafe {
    ///     tup.uninit_assume_init_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// assert_eq!(get!(part_init; 1), 0);
    /// assert_eq!(get!(part_init; 3), vec![1, 2, 3]);
    /// let _: tuple_t!(i32, i32, MaybeUninit<&str>, Vec<i32>, bool) = part_init;
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_subseq<Seq, I>(self) -> Self::PartiallyInitialized
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I> + Sized,
    {
        UninitSubseq::assume_init_subseq(self)
    }

    /// Read the values of a specific subsequence consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_read()`](MaybeUninit::assume_init_read()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<&str>::uninit(),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited = unsafe {
    ///     tup.uninit_assume_init_read_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// assert_eq!(inited, tuple!(0, vec![1, 2, 3]));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_read_subseq<Seq, I>(&self) -> Seq
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::assume_init_read_subseq(self)
    }

    /// Get immutable references to values of a specific subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_ref()`](MaybeUninit::assume_init_ref()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<&str>::uninit(),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_ref = unsafe {
    ///     tup.uninit_assume_init_ref_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// assert_eq!(inited_ref, tuple!(&0, &vec![1, 2, 3]));
    /// unsafe { tup.uninit_assume_init_drop_subseq::<tuple_t!(i32, Vec<i32>), _>() };
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_ref_subseq<Seq, I>(&self) -> <Seq as TupleLike>::AsRefOutput<'_>
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::assume_init_ref_subseq(self)
    }

    /// Get mutable references to values of a specific subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_mut()`](MaybeUninit::assume_init_mut()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<&str>::uninit(),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_mut = unsafe {
    ///     tup.uninit_assume_init_mut_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// *get!(inited_mut; 0) += 1;
    /// get!(inited_mut; 1).push(4);
    /// assert_eq!(inited_mut, tuple!(&mut 1, &mut vec![1, 2, 3, 4]));
    /// unsafe { tup.uninit_assume_init_drop_subseq::<tuple_t!(i32, Vec<i32>), _>() };
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_mut_subseq<Seq, I>(
        &mut self,
    ) -> <Seq as TupleLike>::AsMutOutput<'_>
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::assume_init_mut_subseq(self)
    }

    /// Get pointers to values of a specific subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<&str>::uninit(),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_ptr = tup.uninit_subseq_as_ptr::<tuple_t!(i32, Vec<i32>), _>();
    /// unsafe {
    ///     assert_eq!(*get!(inited_ptr; 0), 0);
    ///     assert_eq!(*get!(inited_ptr; 1), vec![1, 2, 3]);
    ///     tup.uninit_assume_init_drop_subseq::<tuple_t!(i32, Vec<i32>), _>();
    /// }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_subseq_as_ptr<Seq, I>(&self) -> <Seq as TupleLike>::AsPtrOutput
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::subseq_as_ptr(self)
    }

    /// Get mutable pointers to values of a specific subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<&str>::uninit(),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_ptr = tup.uninit_subseq_as_mut_ptr::<tuple_t!(i32, Vec<i32>), _>();
    /// unsafe {
    ///     *get!(inited_ptr; 0) += 1;
    ///     (*get!(inited_ptr; 1)).push(4);
    ///     assert_eq!(*get!(inited_ptr; 0), 1);
    ///     assert_eq!(*get!(inited_ptr; 1), vec![1, 2, 3, 4]);
    ///     tup.uninit_assume_init_drop_subseq::<tuple_t!(i32, Vec<i32>), _>();
    /// }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_subseq_as_mut_ptr<Seq, I>(&mut self) -> <Seq as TupleLike>::AsMutPtrOutput
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::subseq_as_mut_ptr(self)
    }

    /// Set values to a subsequence consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// Similar to [`MaybeUninit::write()`](std::mem::MaybeUninit::write()),
    /// this overwrites any previous value without dropping it.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, bool, &str)>::uninit();
    /// uninit.uninit_write_one(true);
    /// uninit.uninit_write_subseq(tuple!(12, "hello"));
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(12, true, "hello"));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_write_subseq<Seq, I>(&mut self, subseq: Seq) -> Seq::AsMutOutput<'_>
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::write_subseq(self, subseq)
    }

    /// Drop values in place for a subsequence consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// **NOTE**: The subsequence must have one and only one candidate in the supersequence.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_drop()`](std::mem::MaybeUninit::assume_init_drop()).
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_drop_subseq<Seq, I>(&mut self)
    where
        Seq: TupleLike,
        Self: UninitSubseq<Seq, I>,
    {
        UninitSubseq::assume_init_drop_subseq(self)
    }

    /// Extract values of a specific contiguous subsequence consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init()`](MaybeUninit::assume_init()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<i32>::new(13),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let part_init = unsafe {
    ///     tup.uninit_assume_init_con_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// assert_eq!(get!(part_init; 2), 13);
    /// assert_eq!(get!(part_init; 3), vec![1, 2, 3]);
    /// let _: tuple_t!(i32, MaybeUninit<i32>, i32, Vec<i32>, bool) = part_init;
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_con_subseq<Seq, I>(self) -> Self::PartiallyInitialized
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I> + Sized,
    {
        UninitConSubseq::assume_init_con_subseq(self)
    }

    /// Read the values of a specific contiguous subsequence consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_read()`](MaybeUninit::assume_init_read()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<i32>::new(13),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited = unsafe {
    ///     tup.uninit_assume_init_read_con_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// assert_eq!(inited, tuple!(13, vec![1, 2, 3]));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_read_con_subseq<Seq, I>(&self) -> Seq
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::assume_init_read_con_subseq(self)
    }

    /// Get immutable references to values of a specific contiguous subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_ref()`](MaybeUninit::assume_init_ref()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<i32>::new(13),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_ref = unsafe {
    ///     tup.uninit_assume_init_ref_con_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// assert_eq!(inited_ref, tuple!(&13, &vec![1, 2, 3]));
    /// unsafe { tup.uninit_assume_init_drop_con_subseq::<tuple_t!(i32, Vec<i32>), _>() };
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_ref_con_subseq<Seq, I>(
        &self,
    ) -> <Seq as TupleLike>::AsRefOutput<'_>
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::assume_init_ref_con_subseq(self)
    }

    /// Get mutable references to values of a specific contiguous subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_mut()`](MaybeUninit::assume_init_mut()).
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<i32>::new(13),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_mut = unsafe {
    ///     tup.uninit_assume_init_mut_con_subseq::<tuple_t!(i32, Vec<i32>), _>()
    /// };
    /// *get!(inited_mut; 0) += 1;
    /// get!(inited_mut; 1).push(4);
    /// assert_eq!(inited_mut, tuple!(&mut 14, &mut vec![1, 2, 3, 4]));
    /// unsafe { tup.uninit_assume_init_drop_con_subseq::<tuple_t!(i32, Vec<i32>), _>() };
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_mut_con_subseq<Seq, I>(
        &mut self,
    ) -> <Seq as TupleLike>::AsMutOutput<'_>
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::assume_init_mut_con_subseq(self)
    }
    /// Get pointers to values of a specific contiguous subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<i32>::new(13),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_ptr = tup.uninit_con_subseq_as_ptr::<tuple_t!(i32, Vec<i32>), _>();
    /// unsafe {
    ///     assert_eq!(*get!(inited_ptr; 0), 13);
    ///     assert_eq!(*get!(inited_ptr; 1), vec![1, 2, 3]);
    ///     tup.uninit_assume_init_drop_con_subseq::<tuple_t!(i32, Vec<i32>), _>();
    /// }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_con_subseq_as_ptr<Seq, I>(&self) -> <Seq as TupleLike>::AsPtrOutput
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::con_subseq_as_ptr(self)
    }

    /// Get mutable pointers to values of a specific contiguous subsequence
    /// consisting of [`MaybeUninit`] elements.
    ///
    /// # Example
    ///
    /// ```
    /// use std::mem::MaybeUninit;
    /// use tuplez::{get, tuple, TupleLike, tuple_t};
    ///
    /// let mut tup = tuple!(
    ///     12,
    ///     MaybeUninit::<i32>::zeroed(),
    ///     MaybeUninit::<i32>::new(13),
    ///     MaybeUninit::<Vec<i32>>::uninit(),
    ///     false,
    /// );
    /// tup.uninit_write_one(vec![1, 2, 3]);
    /// let inited_ptr = tup.uninit_con_subseq_as_mut_ptr::<tuple_t!(i32, Vec<i32>), _>();
    /// unsafe {
    ///     *get!(inited_ptr; 0) += 1;
    ///     (*get!(inited_ptr; 1)).push(4);
    ///     assert_eq!(*get!(inited_ptr; 0), 14);
    ///     assert_eq!(*get!(inited_ptr; 1), vec![1, 2, 3, 4]);
    ///     tup.uninit_assume_init_drop_con_subseq::<tuple_t!(i32, Vec<i32>), _>();
    /// }
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_con_subseq_as_mut_ptr<Seq, I>(&mut self) -> <Seq as TupleLike>::AsMutPtrOutput
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::con_subseq_as_mut_ptr(self)
    }

    /// Set values to a contiguous subsequence consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// Similar to [`MaybeUninit::write()`](std::mem::MaybeUninit::write()),
    /// this overwrites any previous value without dropping it.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, tuple_t};
    ///
    /// let mut uninit = <tuple_t!(i32, bool, &str)>::uninit();
    /// uninit.uninit_write_one(true);
    /// uninit.uninit_write_subseq(tuple!(12, "hello"));
    /// let tup = unsafe { uninit.uninit_assume_init() };
    /// assert_eq!(tup, tuple!(12, true, "hello"));
    /// ```
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    fn uninit_write_con_subseq<Seq, I>(&mut self, subseq: Seq) -> Seq::AsMutOutput<'_>
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::write_con_subseq(self, subseq)
    }

    /// Drop values in place for a contiguous subsequence consisting of [`MaybeUninit`](std::mem::MaybeUninit) elements.
    ///
    /// **NOTE**: The contiguous subsequence must have one and only one candidate in the supersequence.
    ///
    /// # Safety
    ///
    /// Same as [`MaybeUninit::assume_init_drop()`](std::mem::MaybeUninit::assume_init_drop()).
    #[cfg(feature = "uninit")]
    #[cfg_attr(docsrs, doc(cfg(feature = "uninit")))]
    unsafe fn uninit_assume_init_drop_con_subseq<Seq, I>(&mut self)
    where
        Seq: TupleLike,
        Self: UninitConSubseq<Seq, I>,
    {
        UninitConSubseq::assume_init_drop_con_subseq(self)
    }

    /// Untuple a tuple, whose elements are all tuples.
    ///
    /// See [`to_tuple()`](TupleLike::to_tuple()) for the opposite operation.
    ///
    /// Also called [`flatten()`](TupleLike::flatten()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup_tup = tuple!(tuple!(1, "hello"), tuple!(), tuple!(3.14));
    /// assert_eq!(tup_tup.untuple(), tuple!(1, "hello", 3.14));
    /// ```
    fn untuple(self) -> Self::UntupleOutput
    where
        Self: Untupleable + Sized,
    {
        Untupleable::untuple(self)
    }

    /// Flatten one level of nesting in the tuple.
    ///
    /// Also called [`untuple()`](TupleLike::untuple()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup_tup = tuple!(tuple!(1, "hello"), tuple!(), tuple!(3.14));
    /// assert_eq!(tup_tup.flatten(), tuple!(1, "hello", 3.14));
    /// ```
    fn flatten(self) -> Self::UntupleOutput
    where
        Self: Untupleable + Sized,
    {
        Untupleable::untuple(self)
    }

    /// Traverse the tuple, and collect the output of traversal into a new tuple.
    ///
    /// Check out [`Mapper`](crate::foreach::Mapper)'s documentation page to learn how to build
    /// a mapper that can be passed to [`foreach()`](TupleLike::foreach()).
    ///
    /// NOTE: Traverse a tuple will consume it. If this is not what you want, call [`as_ref()`](TupleLike::as_ref())
    /// or [`as_mut()`](TupleLike::as_mut()) to create a new tuple that references its all members before traversing.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{mapper, tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "hello", 3.14).foreach(mapper! {
    ///     |x: i32| -> i64 { x as i64 }
    ///     |x: f32| -> String { x.to_string() }
    ///     <'a> |x: &'a str| -> &'a [u8] { x.as_bytes() }
    /// });
    /// assert_eq!(tup, tuple!(1i64, b"hello" as &[u8], "3.14".to_string()));
    /// ```
    fn foreach<F>(self, mapper: F) -> <Self as Foreach<F>>::Output
    where
        Self: Foreach<F> + Sized,
    {
        Foreach::foreach(self, mapper)
    }

    /// Fold the tuple.
    ///
    /// Check out [`Folder`](crate::fold::Folder)'s documentation page to learn how to build
    /// a folder that can be passed to [`foreach()`](TupleLike::foreach()).
    ///
    /// NOTE: Fold a tuple will consume it. If this is not what you want, call [`as_ref()`](TupleLike::as_ref())
    /// or [`as_mut()`](TupleLike::as_mut()) to create a new tuple that references its all members before folding.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{folder, tuple, TupleLike};
    ///
    /// let tup = tuple!(Some(1), "2", Some(3.0));
    /// let result = tup.fold(
    ///     folder! { String; // Type of `acc` of all closures must be the same and annotated at the front
    ///         |acc, x: &str| { acc + &x.to_string() }
    ///         <T: ToString> |acc, x: Option<T>| { acc + &x.unwrap().to_string() }
    ///     },
    ///     String::new(),
    /// );
    /// assert_eq!(result, "123".to_string());
    /// ```
    fn fold<F, Acc>(self, folder: F, acc: Acc) -> <Self as Foldable<F, Acc>>::Output
    where
        Self: Foldable<F, Acc> + Sized,
    {
        Foldable::fold(self, folder, acc)
    }

    /// Tests if any element of the tuple matches a predicate.
    ///
    /// Check out [`UnaryPredicate`]'s documentation page to learn how to build
    /// a unary predicate that can be passed to [`any()`](TupleLike::any()).
    ///
    /// [`any()`](TupleLike::any()) is short-circuiting; in other words, it will stop processing as soon as it finds a `true`,
    /// given that no matter what else happens, the result will also be `true`.
    ///
    /// An empty tuple returns `false`.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, unary_pred};
    ///
    /// let predicate = unary_pred! {
    ///     |x: i32| { (0..10).contains(x) },
    ///     |x: &str| { x.parse::<i32>().is_ok() },
    /// };
    ///
    /// let tup = tuple!(100, 2, "world");
    /// let result = tup.any(predicate);
    /// assert_eq!(result, true);
    ///
    /// let tup = tuple!(-1, 96, "hello");
    /// let result = tup.any(predicate);
    /// assert_eq!(result, false);
    /// ```
    fn any<Pred>(&self, predicate: Pred) -> bool
    where
        Self: TestAny<Pred>,
    {
        TestAny::any(self, predicate)
    }

    /// Tests if every element of the tuple matches a predicate.
    ///
    /// Check out [`UnaryPredicate`]'s documentation page to learn how to build
    /// a unary predicate that can be passed to [`all()`](TupleLike::all()).
    ///
    /// [`all()`](TupleLike::all()) is short-circuiting; in other words, it will stop processing as soon as it finds a `false`,
    /// given that no matter what else happens, the result will also be `false`.
    ///
    /// An empty tuple returns `true`.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike, unary_pred};
    ///
    /// let predicate = unary_pred! {
    ///     |x: i32| { (0..10).contains(x) },
    ///     |x: &str| { x.parse::<i32>().is_ok() },
    /// };
    ///
    /// let tup = tuple!(1, 2, "3");
    /// let result = tup.all(predicate);
    /// assert_eq!(result, true);
    ///
    /// let tup = tuple!(7, 8, "hello");
    /// let result = tup.all(predicate);
    /// assert_eq!(result, false);
    /// ```
    fn all<Pred>(&self, predicate: Pred) -> bool
    where
        Self: TestAll<Pred>,
    {
        TestAll::all(self, predicate)
    }

    /// Performs dot product operation.
    ///
    /// Note: it evaluates starting from the last element.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    /// assert_eq!(tuple!(1, 3, -5).dot(tuple!(4, -2, -1)), 3);
    /// ```
    fn dot<T>(self, rhs: T) -> <Self as Dot<T>>::Output
    where
        Self: Dot<T> + Sized,
    {
        Dot::dot(self, rhs)
    }

    /// Zip two tuples.
    ///
    /// See [`unzip()`](TupleLike::unzip()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, 2.0, "3").zip(tuple!("4", 5, 6.0));
    /// assert_eq!(tup, tuple!(tuple!(1, "4"), tuple!(2.0, 5), tuple!("3", 6.0)));
    /// ```
    fn zip<T>(self, rhs: T) -> Self::ZipOutput
    where
        Self: Zippable<T> + Sized,
    {
        Zippable::zip(self, rhs)
    }

    /// Zip two tuples, but output elements are primitive tuples.
    ///
    /// See [`unzip()`](TupleLike::unzip()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, 2.0, "3").zip2(tuple!("4", 5, 6.0));
    /// assert_eq!(tup, tuple!((1, "4"), (2.0, 5), ("3", 6.0)));
    /// ```
    fn zip2<T>(self, rhs: T) -> Self::ZipOutput2
    where
        Self: Zippable<T> + Sized,
    {
        Zippable::zip2(self, rhs)
    }

    /// Unzip a tuple to two tuples, if all elements of the tuple are tuples with two elements.
    /// Elements can be of [`Tuple`] type or primitive tuple type.
    ///
    /// See [`zip()`](TupleLike::zip()) and [`zip2()`](TupleLike::zip2()) for the opposite operation.
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(
    ///     tuple!(1, "hello"), // A `Tuple`
    ///     ("world", 2.0),     // A primitive tuple
    /// );
    /// let (l, r) = tup.unzip();
    /// assert_eq!(l, tuple!(1, "world"));
    /// assert_eq!(r, tuple!("hello", 2.0));
    /// ```
    fn unzip(self) -> (Self::UnzipOutputLeft, Self::UnzipOutputRight)
    where
        Self: Unzippable + Sized,
    {
        Unzippable::unzip(self)
    }

    /// If the elements of a tuple are all tuples, push an element to the back of each tuple element.
    ///
    /// See [`shrink()`](TupleLike::shrink()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(tuple!(1, "hello"), tuple!(), tuple!(3.14));
    /// let ext = tuple!(9.0, "8", 7);
    /// assert_eq!(
    ///     tup.extend(ext),
    ///     tuple!(tuple!(1, "hello", 9.0), tuple!("8"), tuple!(3.14, 7))
    /// );
    /// ```
    fn extend<T>(self, rhs: T) -> Self::ExtendBackOutput
    where
        Self: Extendable<T> + Sized,
    {
        Extendable::extend(self, rhs)
    }

    /// If the elements of a tuple are all tuples, push an element to the front of each tuple element.
    ///
    /// See [`shrink_front()`](TupleLike::shrink_front()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(tuple!(1, "hello"), tuple!(), tuple!(3.14));
    /// let ext = tuple!(9.0, "8", 7);
    /// assert_eq!(
    ///     tup.extend_front(ext),
    ///     tuple!(tuple!(9.0, 1, "hello"), tuple!("8"), tuple!(7, 3.14))
    /// );
    /// ```
    fn extend_front<T>(self, rhs: T) -> Self::ExtendFrontOutput
    where
        Self: Extendable<T> + Sized,
    {
        Extendable::extend_front(self, rhs)
    }

    /// If the elements of a tuple are all tuples, push an element to the front of each tuple element.
    /// Same as [`extend()`](TupleLike::extend()).
    fn extend_back<T>(self, rhs: T) -> Self::ExtendBackOutput
    where
        Self: Extendable<T> + Sized,
    {
        Extendable::extend_back(self, rhs)
    }

    /// If the elements of a tuple are all tuples, pop an element from the back of each tuple element.
    ///
    /// See [`extend()`](TupleLike::extend()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(tuple!(9.0, 1, "hello"), tuple!("8"), tuple!(7, 3.14));
    /// let (result, popped) = tup.shrink();
    /// assert_eq!(result, tuple!(tuple!(9.0, 1), tuple!(), tuple!(7)));
    /// assert_eq!(popped, tuple!("hello", "8", 3.14));
    /// ```
    fn shrink(self) -> (Self::ShrinkBackOutput, Self::ShrinkBackElements)
    where
        Self: Shrinkable + Sized,
    {
        Shrinkable::shrink(self)
    }

    /// If the elements of a tuple are all tuples, pop an element from the front of each tuple element.
    ///
    /// See [`extend_front()`](TupleLike::extend_front()) for the opposite operation.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(tuple!(9.0, 1, "hello"), tuple!("8"), tuple!(7, 3.14));
    /// let (result, popped) = tup.shrink_front();
    /// assert_eq!(result, tuple!(tuple!(1, "hello"), tuple!(), tuple!(3.14)));
    /// assert_eq!(popped, tuple!(9.0, "8", 7));
    /// ```
    fn shrink_front(self) -> (Self::ShrinkFrontOutput, Self::ShrinkFrontElements)
    where
        Self: Shrinkable + Sized,
    {
        Shrinkable::shrink_front(self)
    }

    /// If the elements of a tuple are all tuples, pop an element from the back of each tuple element.
    /// Same as [`shrink()`](TupleLike::shrink()).
    fn shrink_back(self) -> (Self::ShrinkBackOutput, Self::ShrinkBackElements)
    where
        Self: Shrinkable + Sized,
    {
        Shrinkable::shrink_back(self)
    }

    /// If two tuples have the same number of elements, and their elements are both tuples,
    /// join their tuple elements one-to-one.
    ///
    /// NOTE: This method is not [`join()`](TupleLike::join()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(tuple!(1), tuple!(), tuple!("hello", 3.14));
    /// let tup2 = tuple!(tuple!(), tuple!(9, "8"), tuple!(7.0));
    /// let tup3 = tup.combine(tup2);
    /// assert_eq!(tup3, tuple!(tuple!(1), tuple!(9, "8"), tuple!("hello", 3.14, 7.0)));
    /// ```
    fn combine<T>(self, rhs: T) -> Self::CombineOutput
    where
        Self: Combinable<T> + Sized,
    {
        Combinable::combine(self, rhs)
    }

    /// Replace the first N elements of the tuple with all elements of another tuple of N elements.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "2", 3.0, Some(4));
    /// let tup2 = tuple!("z", 8);
    /// let (output, replaced) = tup.replace_head(tup2);
    /// assert_eq!(output, tuple!("z", 8, 3.0, Some(4)));
    /// assert_eq!(replaced, tuple!(1, "2"));
    /// ```
    fn replace_head<T>(self, rhs: T) -> (Self::ReplaceOutput, Self::Replaced)
    where
        T: TupleLike,
        Self: HeadReplaceable<T> + Sized,
    {
        HeadReplaceable::replace_head(self, rhs)
    }

    /// Replace the last N elements of the tuple with all elements of another tuple of N elements.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(1, "2", 3.0, Some(4));
    /// let tup2 = tuple!("z", 8);
    /// let (output, replaced) = tup.replace_tail(tup2);
    /// assert_eq!(output, tuple!(1, "2", "z", 8));
    /// assert_eq!(replaced, tuple!(3.0, Some(4)));
    /// ```
    fn replace_tail<T, I>(self, rhs: T) -> (Self::ReplaceOutput, Self::Replaced)
    where
        T: TupleLike,
        Self: TailReplaceable<T, I> + Sized,
    {
        TailReplaceable::replace_tail(self, rhs)
    }

    /// When all elements of the tuple implement [`Fn(T)`](std::ops::Fn) for a specific `T`,
    /// call them once in sequence.
    ///
    /// # Example
    ///
    /// It is required that `T` implements [`Clone`].
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// fn add1(x: i32) -> i32 {
    ///     x + 1
    /// }
    /// fn add2(x: i32) -> i32 {
    ///     x + 2
    /// }
    /// fn to_string(x: i32) -> String {
    ///     x.to_string()
    /// }
    ///
    /// let tup = tuple!(add1, add2, to_string).call(1);
    /// assert_eq!(tup, tuple!(2, 3, "1".to_string()));
    /// ```
    ///
    /// ...however, due to the existence of reborrowing, we can use some tricks to allow
    /// the mutable references to be used as parameters multiple times.
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// fn add1(x: &mut i32) {
    ///     *x += 1
    /// }
    /// fn add2(x: &mut i32) {
    ///     *x += 2
    /// }
    /// fn to_string(x: &mut i32) -> String {
    ///     x.to_string()
    /// }
    ///
    /// let mut x = 1;
    /// let tup = tuple!(add1, add2, to_string).call(&mut x);
    /// assert_eq!(x, 4);
    /// assert_eq!(tup, tuple!((), (), "4".to_string()));
    /// ```
    fn call<T, P>(&self, rhs: T) -> <Self as Callable<T, P>>::Output
    where
        Self: Callable<T, P>,
    {
        Callable::call(self, rhs)
    }

    /// When all elements of the tuple implement [`FnMut(T)`](std::ops::FnMut) for a specific `T`,
    /// call them once in sequence.
    ///
    /// Basically the same as [`call()`](TupleLike::call()), but elements are required to implement
    /// [`FnMut(T)`](std::ops::FnMut) instead of [`Fn(T)`](std::ops::Fn).
    fn call_mut<T, P>(&mut self, rhs: T) -> <Self as MutCallable<T, P>>::Output
    where
        Self: MutCallable<T, P>,
    {
        MutCallable::call_mut(self, rhs)
    }

    /// When all elements of the tuple implement [`FnOnce(T)`](std::ops::FnOnce) for a specific `T`,
    /// call them once in sequence.
    ///
    /// Basically the same as [`call()`](TupleLike::call()), but elements are required to implement
    /// [`FnOnce(T)`](std::ops::FnOnce) instead of [`Fn(T)`](std::ops::Fn).
    fn call_once<T, P>(self, rhs: T) -> <Self as OnceCallable<T, P>>::Output
    where
        Self: OnceCallable<T, P> + Sized,
    {
        OnceCallable::call_once(self, rhs)
    }

    /// Convert from `Tuple<Wrapper0<T0>, Wrapper1<T1>, ... Wrappern<Tn>>` to `Tuple<T0, T1, ..., Tn>`,
    /// when all element types `Wrapper0`, `Wrapper1` ... `Wrappern` implement [`Unwrap`].
    ///
    /// Because this function may panic, its use is generally discouraged. Instead,
    /// use [`unwrap_or_default()`](TupleLike::unwrap_or_default()) or
    /// [`try_unwrap()`](TupleLike::try_unwrap()).
    ///
    /// # Panic
    ///
    /// Panic if any element does not contain a value.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(Some(1), Ok::<f32, ()>(3.14), Some("hello"));
    /// assert_eq!(tup.unwrap(), tuple!(1, 3.14, "hello"));
    /// ```
    #[cfg(feature = "unwrap")]
    #[cfg_attr(docsrs, doc(cfg(feature = "unwrap")))]
    fn unwrap(self) -> Self::UnwrapOutput
    where
        Self: Unwrap + Sized,
    {
        Unwrap::unwrap(self)
    }

    /// Check if self can be safely [`unwrap()`](TupleLike::unwrap()).
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// assert_eq!(tuple!(Some(1), Some(3.14), Ok::<&str, ()>("hello")).has_value(), true);
    /// assert_eq!(tuple!(None::<i32>, Some(3.14), Err::<&str, ()>(())).has_value(), false);
    /// ```
    #[cfg(feature = "unwrap")]
    #[cfg_attr(docsrs, doc(cfg(feature = "unwrap")))]
    fn has_value(&self) -> bool
    where
        Self: Unwrap,
    {
        Unwrap::has_value(self)
    }

    /// Convert from `Tuple<Wrapper0<T0>, Wrapper1<T1>, ... Wrappern<Tn>>` to `Tuple<T0, T1, ..., Tn>`,
    /// when all element types `Wrapper0`, `Wrapper1` ... `Wrappern` implement [`UnwrapOrDefault`].
    ///
    /// Unlike [`unwrap()`](TupleLike::unwrap()), if an element does not contain a value, use the
    /// default value instead of panic.
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(Some(1), Err::<f32, &str>("failed"), Some("hello"));
    /// assert_eq!(tup.unwrap_or_default(), tuple!(1, 0.0, "hello"));
    /// ```
    #[cfg(feature = "unwrap")]
    #[cfg_attr(docsrs, doc(cfg(feature = "unwrap")))]
    fn unwrap_or_default(self) -> Self::UnwrapOutput
    where
        Self: UnwrapOrDefault + Sized,
    {
        UnwrapOrDefault::unwrap_or_default(self)
    }

    /// Convert from `Tuple<Wrapper0<T0>, Wrapper1<T1>, ... Wrappern<Tn>>` to `Option<Tuple<T0, T1, ..., Tn>>`,
    /// when all element types `Wrapper0`, `Wrapper1` ... `Wrappern` implement [`Unwrap`].
    ///
    /// # Example
    ///
    /// ```
    /// use tuplez::{tuple, TupleLike};
    ///
    /// let tup = tuple!(Some(1), Ok::<f32, ()>(3.14));
    /// assert_eq!(tup.try_unwrap(), Some(tuple!(1, 3.14)));
    /// let tup2 = tuple!(Some("hello"), Err::<i32, &str>("failed"));
    /// assert_eq!(tup2.try_unwrap(), None);
    /// ```
    #[cfg(feature = "unwrap")]
    #[cfg_attr(docsrs, doc(cfg(feature = "unwrap")))]
    fn try_unwrap(self) -> Option<Self::UnwrapOutput>
    where
        Self: Unwrap + Sized,
    {
        if Unwrap::has_value(&self) {
            Some(Unwrap::unwrap(self))
        } else {
            None
        }
    }
}

impl TupleLike for Unit {
    type AsRefOutput<'a> = Unit;
    type AsMutOutput<'a> = Unit;
    type AsPtrOutput = Unit;
    type AsMutPtrOutput = Unit;
    type AsPinRefOutput<'a> = Unit;
    type AsPinMutOutput<'a> = Unit;
    type PushFrontOutput<T> = Tuple<T, Unit>;
    type PushBackOutput<T> = Tuple<T, Unit>;
    type RevOutput = Unit;
    type JoinOutput<T>
        = T
    where
        T: TupleLike;
    type ToSomeOutput = Unit;
    type ToOkOutput<E> = Unit;
    type ToTupleOutput = Unit;
    #[cfg(feature = "uninit")]
    type Uninit = Unit;

    const LEN: usize = 0;

    fn as_ref(&self) -> Self::AsRefOutput<'_> {
        Self
    }

    fn as_mut(&mut self) -> Self::AsMutOutput<'_> {
        Self
    }

    fn as_ptr(&self) -> Self::AsPtrOutput {
        Unit
    }

    fn as_mut_ptr(&mut self) -> Self::AsMutPtrOutput {
        Unit
    }

    fn as_pin_ref(self: Pin<&Self>) -> Self::AsPinRefOutput<'_> {
        Unit
    }

    fn as_pin_mut(self: Pin<&mut Self>) -> Self::AsPinMutOutput<'_> {
        Unit
    }

    fn push<T>(self, value: T) -> Self::PushBackOutput<T> {
        Tuple(value, self)
    }

    fn push_front<T>(self, value: T) -> Self::PushFrontOutput<T> {
        Tuple(value, self)
    }

    fn push_back<T>(self, value: T) -> Self::PushBackOutput<T> {
        Tuple(value, self)
    }

    fn rev(self) -> Self::RevOutput {
        self
    }

    fn join<T>(self, value: T) -> Self::JoinOutput<T>
    where
        T: TupleLike,
    {
        value
    }

    fn to_some(self) -> Self::ToSomeOutput {
        self
    }

    fn to_ok<E>(self) -> Self::ToOkOutput<E> {
        self
    }

    fn to_tuple(self) -> Self::ToTupleOutput {
        self
    }

    #[cfg(feature = "uninit")]
    fn uninit() -> Self::Uninit {
        Unit
    }

    #[cfg(feature = "uninit")]
    fn zeroed() -> Self::Uninit {
        Unit
    }

    #[cfg(feature = "uninit")]
    fn to_uninit(self) -> Self::Uninit {
        Unit
    }
}

impl<First, Other> TupleLike for Tuple<First, Other>
where
    Other: TupleLike,
{
    type AsRefOutput<'a>
        = Tuple<&'a First, Other::AsRefOutput<'a>>
    where
        Self: 'a;
    type AsMutOutput<'a>
        = Tuple<&'a mut First, Other::AsMutOutput<'a>>
    where
        Self: 'a;
    type AsPtrOutput = Tuple<*const First, Other::AsPtrOutput>;
    type AsMutPtrOutput = Tuple<*mut First, Other::AsMutPtrOutput>;
    type AsPinRefOutput<'a>
        = Tuple<Pin<&'a First>, Other::AsPinRefOutput<'a>>
    where
        Self: 'a;
    type AsPinMutOutput<'a>
        = Tuple<Pin<&'a mut First>, Other::AsPinMutOutput<'a>>
    where
        Self: 'a;
    type PushFrontOutput<T> = Tuple<T, Self>;
    type PushBackOutput<T> = Tuple<First, Other::PushBackOutput<T>>;
    type RevOutput = <Other::RevOutput as TupleLike>::PushBackOutput<First>;
    type JoinOutput<T>
        = Tuple<First, Other::JoinOutput<T>>
    where
        T: TupleLike;
    type ToSomeOutput = Tuple<Option<First>, Other::ToSomeOutput>;
    type ToOkOutput<E> = Tuple<Result<First, E>, Other::ToOkOutput<E>>;
    type ToTupleOutput = Tuple<Tuple<First, Unit>, Other::ToTupleOutput>;
    #[cfg(feature = "uninit")]
    type Uninit = Tuple<MaybeUninit<First>, Other::Uninit>;

    const LEN: usize = Other::LEN + 1;

    fn as_ref(&self) -> Self::AsRefOutput<'_> {
        Tuple(&self.0, self.1.as_ref())
    }

    fn as_mut(&mut self) -> Self::AsMutOutput<'_> {
        Tuple(&mut self.0, self.1.as_mut())
    }

    fn as_ptr(&self) -> Self::AsPtrOutput {
        Tuple(&self.0, self.1.as_ptr())
    }

    fn as_mut_ptr(&mut self) -> Self::AsMutPtrOutput {
        Tuple(&mut self.0, self.1.as_mut_ptr())
    }

    fn as_pin_ref(self: Pin<&Self>) -> Self::AsPinRefOutput<'_> {
        let this = Pin::get_ref(self);
        unsafe {
            Tuple(
                Pin::new_unchecked(&this.0),
                Pin::new_unchecked(&this.1).as_pin_ref(),
            )
        }
    }

    fn as_pin_mut(self: Pin<&mut Self>) -> Self::AsPinMutOutput<'_> {
        unsafe {
            let this = Pin::get_unchecked_mut(self);
            Tuple(
                Pin::new_unchecked(&mut this.0),
                Pin::new_unchecked(&mut this.1).as_pin_mut(),
            )
        }
    }

    fn push<T>(self, value: T) -> Self::PushBackOutput<T> {
        Tuple(self.0, self.1.push(value))
    }

    fn push_front<T>(self, value: T) -> Self::PushFrontOutput<T> {
        Tuple(value, self)
    }

    fn push_back<T>(self, value: T) -> Self::PushBackOutput<T> {
        self.push::<T>(value)
    }

    fn rev(self) -> Self::RevOutput {
        self.1.rev().push(self.0)
    }

    fn join<T>(self, value: T) -> Self::JoinOutput<T>
    where
        T: TupleLike,
    {
        Tuple(self.0, self.1.join(value))
    }

    fn to_some(self) -> Self::ToSomeOutput {
        Tuple(Some(self.0), self.1.to_some())
    }

    fn to_ok<E>(self) -> Self::ToOkOutput<E> {
        Tuple(Ok(self.0), self.1.to_ok())
    }

    fn to_tuple(self) -> Self::ToTupleOutput {
        Tuple(Tuple(self.0, Unit), self.1.to_tuple())
    }

    #[cfg(feature = "uninit")]
    fn uninit() -> Self::Uninit {
        Tuple(MaybeUninit::uninit(), Other::uninit())
    }

    #[cfg(feature = "uninit")]
    fn zeroed() -> Self::Uninit {
        Tuple(MaybeUninit::zeroed(), Other::zeroed())
    }

    #[cfg(feature = "uninit")]
    fn to_uninit(self) -> Self::Uninit {
        Tuple(MaybeUninit::new(self.0), TupleLike::to_uninit(self.1))
    }
}

/// A Marker trait to indicate that two tuple types have the same number of elements.
///
/// **FIXME**: Once the [`generic_const_exprs` feature](https://github.com/rust-lang/rust/issues/76560)
/// and the [`associated_const_equality` feature](https://github.com/rust-lang/rust/issues/92827) are
/// stabilized, this trait is no longer needed. Instead, we can write:
///
/// ```ignore
/// use tuplez::TupleLike;
///
/// fn use_tuple<T, U>(t: T, u: U)
/// where
///     T: TupleLike,
///     U: TupleLike<LEN = { T::LEN }>,
/// {
///     // ...
/// }
/// ```
///
/// # Example
///
/// Use with [`tuple_t!`](crate::tuple_t!) macro to constrain the number of elements of the tuple.
///
/// ```
/// use tuplez::{tuple, tuple_t, TupleLenEqTo, TupleLike};
///
/// fn only_accept_5_elements<T>(_: T)
/// where
///     T: TupleLenEqTo<tuple_t!((); 5)>
/// {
/// }
///
/// let tup4 = tuple!(1, 2.0, "3", 4);
/// // only_accept_5_elements(tup4);    // Error: the trait bound is not satisfied
/// let tup5 = tup4.push_back('5');
/// only_accept_5_elements(tup5);       // Ok
/// let tup6 = tup5.push_back(6.0);
/// // only_accept_5_elements(tup6);    // Error: the trait bound is not satisfied
/// ```
pub trait TupleLenEqTo<T: TupleLike>: TupleLike {}

impl TupleLenEqTo<Unit> for Unit {}

impl<First1, Other1, First2, Other2> TupleLenEqTo<Tuple<First2, Other2>> for Tuple<First1, Other1>
where
    Other1: TupleLenEqTo<Other2>,
    Other2: TupleLike,
{
}

/// Convert from tuples to [primitive tuples](https://doc.rust-lang.org/std/primitive.tuple.html).
///
/// Note that due to the limitation that Rust cannot represent primitive tuple types containing any number of elements,
/// the trait [`ToPrimitive`] is only implemented for tuples with no more than 32 elements.
pub trait ToPrimitive {
    /// The primitive tuple type containing the same number and order of elements.
    type Primitive;

    /// Convert from the tuple to the primitive tuple.
    ///
    /// # Examples
    ///
    /// ```
    /// use tuplez::{ToPrimitive, tuple};
    ///
    /// let tup = tuple!(1, "2", 3.0, 4);
    /// let prim = tup.primitive();
    /// assert_eq!(prim, (1, "2", 3.0, 4));
    /// ```
    fn primitive(self) -> Self::Primitive;
}

/// Convert from tuples to [primitive arrays](std::array), if all elements of the tuple are of the same type.
///
/// Because the [generic constant expressions](https://github.com/rust-lang/rust/issues/76560) feature is still unstable yet,
/// we can only limit the maximum number of elements of the tuple that implement [`ToArray`] to 32,
/// just like what we did with the primitive tuples.
///
/// However, if you are OK with using rustc released to nightly channel to compile codes with unstable features,
/// you can enable the `any_array` feature to implement [`ToArray`] on tuples with no limit on the number of elements.
///
/// ```toml
/// tuplez = { features = [ "any_array" ] }
/// ```
///
/// Always remember: unstable features are not guaranteed by Rust and may not be available someday in the future.
///
/// Why `<T>` instead of `type Item`? Well, this is because the [`Unit`]s can be converted to any `[T; 0]`.
pub trait ToArray<T>: TupleLike {
    /// The primitive array type to generate.
    type Array: IntoIterator<Item = T>;

    /// Immutable element iterator type.
    type Iter<'a>: Iterator<Item = &'a T>
    where
        Self::AsRefOutput<'a>: ToArray<&'a T>,
        Self: 'a,
        T: 'a;

    /// Mutable element iterator type.
    type IterMut<'a>: Iterator<Item = &'a mut T>
    where
        Self::AsMutOutput<'a>: ToArray<&'a mut T>,
        Self: 'a,
        T: 'a;

    /// Convert from the tuple to the primitive array.
    ///
    /// # Example
    ///
    /// ```
    /// # #![cfg_attr(feature = "any_array", feature(generic_const_exprs))]
    /// #
    /// use tuplez::{tuple, ToArray};
    ///
    /// let tup = tuple!(1, 2, 3, 4, 5, 6);
    /// assert_eq!(tup.to_array(), [1, 2, 3, 4, 5, 6]);
    /// ```
    fn to_array(self) -> Self::Array;

    /// Get immutable element iterator.
    ///
    /// # Example
    ///
    /// ```
    /// # #![cfg_attr(feature = "any_array", feature(generic_const_exprs))]
    /// #
    /// use tuplez::{tuple, ToArray};
    ///
    /// let tup = tuple!(1, 2, 3, 4, 5, 6);
    /// assert_eq!(tup.iter().sum::<i32>(), 21);
    /// ```
    fn iter<'a>(&'a self) -> Self::Iter<'a>
    where
        Self::AsRefOutput<'a>: ToArray<&'a T>,
        Self: 'a,
        T: 'a;

    /// Get mutable element iterator.
    ///
    /// # Example
    ///
    /// ```
    /// # #![cfg_attr(feature = "any_array", feature(generic_const_exprs))]
    /// #
    /// use tuplez::{tuple, ToArray};
    ///
    /// let mut tup = tuple!(1, 2, 3, 4, 5, 6);
    /// tup.iter_mut().for_each(|v| *v += 1);
    /// assert_eq!(tup.iter().sum::<i32>(), 27);
    /// ```
    fn iter_mut<'a>(&'a mut self) -> Self::IterMut<'a>
    where
        Self::AsMutOutput<'a>: ToArray<&'a mut T>,
        Self: 'a,
        T: 'a;
}

tuple_traits_impl!(32);

__tuple_unary_ops_impl! {
    Neg::neg(),
    Not::not(),
}

__tuple_binary_ops_impl! {
    Add::add(),
    Sub::sub(),
    Mul::mul(),
    Div::div(),
    Rem::rem(),
    BitAnd::bitand(),
    BitOr::bitor(),
    BitXor::bitxor(),
    Shl::shl(),
    Shr::shr(),
}

__tuple_assignment_ops_impl! {
    AddAssign::add_assign(),
    SubAssign::sub_assign(),
    MulAssign::mul_assign(),
    DivAssign::div_assign(),
    RemAssign::rem_assign(),
    BitAndAssign::bitand_assign(),
    BitOrAssign::bitor_assign(),
    BitXorAssign::bitxor_assign(),
    ShlAssign::shl_assign(),
    ShrAssign::shr_assign(),
}

impl<T, Other> IntoIterator for Tuple<T, Other>
where
    Tuple<T, Other>: ToArray<T>,
{
    type Item = T;
    type IntoIter = <<Self as ToArray<T>>::Array as IntoIterator>::IntoIter;

    fn into_iter(self) -> Self::IntoIter {
        self.to_array().into_iter()
    }
}

impl<'a, T, Other> IntoIterator for &'a Tuple<T, Other>
where
    Tuple<T, Other>: TupleLike,
    <Tuple<T, Other> as TupleLike>::AsRefOutput<'a>: ToArray<&'a T>,
{
    type Item = &'a T;
    type IntoIter = <<<Tuple<T, Other> as TupleLike>::AsRefOutput<'a> as ToArray<&'a T>>::Array as IntoIterator>::IntoIter;

    fn into_iter(self) -> Self::IntoIter {
        self.as_ref().to_array().into_iter()
    }
}

impl<'a, T, Other> IntoIterator for &'a mut Tuple<T, Other>
where
    Tuple<T, Other>: TupleLike,
    <Tuple<T, Other> as TupleLike>::AsMutOutput<'a>: ToArray<&'a mut T>,
{
    type Item = &'a mut T;
    type IntoIter = <<<Tuple<T, Other> as TupleLike>::AsMutOutput<'a> as ToArray<&'a mut T>>::Array as IntoIterator>::IntoIter;

    fn into_iter(self) -> Self::IntoIter {
        self.as_mut().to_array().into_iter()
    }
}