-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathecho.js
1277 lines (1148 loc) · 34.6 KB
/
echo.js
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
let wasm;
export function __wbg_set_wasm(val) {
wasm = val;
}
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
let WASM_VECTOR_LEN = 0;
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
let cachedTextEncoder = new lTextEncoder('utf-8');
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
});
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function isLikeNone(x) {
return x === undefined || x === null;
}
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_u8(a) {
const ret = wasm.echo_u8(a);
return ret;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_i8(a) {
const ret = wasm.echo_i8(a);
return ret;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_u16(a) {
const ret = wasm.echo_u16(a);
return ret;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_i16(a) {
const ret = wasm.echo_i16(a);
return ret;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_u32(a) {
const ret = wasm.echo_u32(a);
return ret >>> 0;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_i32(a) {
const ret = wasm.echo_i32(a);
return ret;
}
/**
* @param {bigint | number} a
* @returns {bigint}
*/
export function echo_u64(a) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const ret = wasm.echo_u64(bigint0);
return BigInt.asUintN(64, ret);
}
/**
* @param {bigint | number} a
* @returns {bigint}
*/
export function echo_i64(a) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const ret = wasm.echo_i64(bigint0);
return ret;
}
/**
* @param {bigint} a
* @returns {bigint}
*/
export function echo_u128(a) {
const ret = wasm.echo_u128(a, a >> BigInt(64));
return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
}
/**
* @param {bigint} a
* @returns {bigint}
*/
export function echo_i128(a) {
const ret = wasm.echo_i128(a, a >> BigInt(64));
return (BigInt.asUintN(64, ret[0]) | (ret[1] << BigInt(64)));
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_usize(a) {
const ret = wasm.echo_usize(a);
return ret >>> 0;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_isize(a) {
const ret = wasm.echo_isize(a);
return ret;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_f32(a) {
const ret = wasm.echo_f32(a);
return ret;
}
/**
* @param {number} a
* @returns {number}
*/
export function echo_f64(a) {
const ret = wasm.echo_f64(a);
return ret;
}
/**
* @param {boolean} a
* @returns {boolean}
*/
export function echo_bool(a) {
const ret = wasm.echo_bool(a);
return ret !== 0;
}
function _assertChar(c) {
if (typeof(c) === 'number' && (c >= 0x110000 || (c >= 0xD800 && c < 0xE000))) throw new Error(`expected a valid Unicode scalar value, found ${c}`);
}
/**
* @param {string} a
* @returns {string}
*/
export function echo_char(a) {
const char0 = a.codePointAt(0);
_assertChar(char0);
const ret = wasm.echo_char(char0);
return String.fromCodePoint(ret);
}
/**
* @param {string} a
* @returns {string}
*/
export function echo_string(a) {
let deferred2_0;
let deferred2_1;
try {
const ptr0 = passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_string(ptr0, len0);
deferred2_0 = ret[0];
deferred2_1 = ret[1];
return getStringFromWasm0(ret[0], ret[1]);
} finally {
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* @param {Uint8Array} a
* @returns {Uint8Array}
*/
export function echo_vec_u8(a) {
const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_u8(ptr0, len0);
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
return v2;
}
let cachedInt8ArrayMemory0 = null;
function getInt8ArrayMemory0() {
if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) {
cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer);
}
return cachedInt8ArrayMemory0;
}
function getArrayI8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* @param {Int8Array} a
* @returns {Int8Array}
*/
export function echo_vec_i8(a) {
const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_i8(ptr0, len0);
var v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
return v2;
}
let cachedUint16ArrayMemory0 = null;
function getUint16ArrayMemory0() {
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
}
return cachedUint16ArrayMemory0;
}
function passArray16ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 2, 2) >>> 0;
getUint16ArrayMemory0().set(arg, ptr / 2);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU16FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
}
/**
* @param {Uint16Array} a
* @returns {Uint16Array}
*/
export function echo_vec_u16(a) {
const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_u16(ptr0, len0);
var v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
return v2;
}
let cachedInt16ArrayMemory0 = null;
function getInt16ArrayMemory0() {
if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) {
cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer);
}
return cachedInt16ArrayMemory0;
}
function getArrayI16FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
}
/**
* @param {Int16Array} a
* @returns {Int16Array}
*/
export function echo_vec_i16(a) {
const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_i16(ptr0, len0);
var v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
return v2;
}
let cachedUint32ArrayMemory0 = null;
function getUint32ArrayMemory0() {
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32ArrayMemory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4, 4) >>> 0;
getUint32ArrayMemory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* @param {Uint32Array} a
* @returns {Uint32Array}
*/
export function echo_vec_u32(a) {
const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_u32(ptr0, len0);
var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v2;
}
let cachedInt32ArrayMemory0 = null;
function getInt32ArrayMemory0() {
if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32ArrayMemory0;
}
function getArrayI32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* @param {Int32Array} a
* @returns {Int32Array}
*/
export function echo_vec_i32(a) {
const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_i32(ptr0, len0);
var v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v2;
}
let cachedBigUint64ArrayMemory0 = null;
function getBigUint64ArrayMemory0() {
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
}
return cachedBigUint64ArrayMemory0;
}
function passArray64ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 8, 8) >>> 0;
getBigUint64ArrayMemory0().set(arg, ptr / 8);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU64FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
}
/**
* @param {BigUint64Array} a
* @returns {BigUint64Array}
*/
export function echo_vec_u64(a) {
const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_u64(ptr0, len0);
var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
return v2;
}
let cachedBigInt64ArrayMemory0 = null;
function getBigInt64ArrayMemory0() {
if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
}
return cachedBigInt64ArrayMemory0;
}
function getArrayI64FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
}
/**
* @param {BigInt64Array} a
* @returns {BigInt64Array}
*/
export function echo_vec_i64(a) {
const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_i64(ptr0, len0);
var v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
return v2;
}
/**
* @param {Uint8Array} a
* @returns {Uint8Array}
*/
export function echo_vec_uninit_u8(a) {
const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_u8(ptr0, len0);
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
return v2;
}
/**
* @param {Int8Array} a
* @returns {Int8Array}
*/
export function echo_vec_uninit_i8(a) {
const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_i8(ptr0, len0);
var v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
return v2;
}
/**
* @param {Uint16Array} a
* @returns {Uint16Array}
*/
export function echo_vec_uninit_u16(a) {
const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_u16(ptr0, len0);
var v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
return v2;
}
/**
* @param {Int16Array} a
* @returns {Int16Array}
*/
export function echo_vec_uninit_i16(a) {
const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_i16(ptr0, len0);
var v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
return v2;
}
/**
* @param {Uint32Array} a
* @returns {Uint32Array}
*/
export function echo_vec_uninit_u32(a) {
const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_u32(ptr0, len0);
var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v2;
}
/**
* @param {Int32Array} a
* @returns {Int32Array}
*/
export function echo_vec_uninit_i32(a) {
const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_i32(ptr0, len0);
var v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v2;
}
/**
* @param {BigUint64Array} a
* @returns {BigUint64Array}
*/
export function echo_vec_uninit_u64(a) {
const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_u64(ptr0, len0);
var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
return v2;
}
/**
* @param {BigInt64Array} a
* @returns {BigInt64Array}
*/
export function echo_vec_uninit_i64(a) {
const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_uninit_i64(ptr0, len0);
var v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
return v2;
}
function addToExternrefTable0(obj) {
const idx = wasm.__externref_table_alloc();
wasm.__wbindgen_export_2.set(idx, obj);
return idx;
}
function passArrayJsValueToWasm0(array, malloc) {
const ptr = malloc(array.length * 4, 4) >>> 0;
const mem = getDataViewMemory0();
for (let i = 0; i < array.length; i++) {
mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
}
WASM_VECTOR_LEN = array.length;
return ptr;
}
function getArrayJsValueFromWasm0(ptr, len) {
ptr = ptr >>> 0;
const mem = getDataViewMemory0();
const result = [];
for (let i = ptr; i < ptr + 4 * len; i += 4) {
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
}
wasm.__externref_drop_slice(ptr, len);
return result;
}
/**
* @param {(string)[]} a
* @returns {(string)[]}
*/
export function echo_vec_string(a) {
const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_string(ptr0, len0);
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v2;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
}
/**
* @param {Foo} a
* @returns {Foo}
*/
export function echo_struct(a) {
_assertClass(a, Foo);
var ptr0 = a.__destroy_into_raw();
const ret = wasm.echo_struct(ptr0);
return Foo.__wrap(ret);
}
/**
* @param {(Foo)[]} a
* @returns {(Foo)[]}
*/
export function echo_vec_struct(a) {
const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_vec_struct(ptr0, len0);
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v2;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_u8(a) {
const ret = wasm.echo_option_u8(isLikeNone(a) ? 0xFFFFFF : a);
return ret === 0xFFFFFF ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_i8(a) {
const ret = wasm.echo_option_i8(isLikeNone(a) ? 0xFFFFFF : a);
return ret === 0xFFFFFF ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_u16(a) {
const ret = wasm.echo_option_u16(isLikeNone(a) ? 0xFFFFFF : a);
return ret === 0xFFFFFF ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_i16(a) {
const ret = wasm.echo_option_i16(isLikeNone(a) ? 0xFFFFFF : a);
return ret === 0xFFFFFF ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_u32(a) {
const ret = wasm.echo_option_u32(isLikeNone(a) ? 0x100000001 : (a) >>> 0);
return ret === 0x100000001 ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_i32(a) {
const ret = wasm.echo_option_i32(isLikeNone(a) ? 0x100000001 : (a) >> 0);
return ret === 0x100000001 ? undefined : ret;
}
/**
* @param {bigint | number | null} [a]
* @returns {bigint | undefined}
*/
export function echo_option_u64(a) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const ret = wasm.echo_option_u64(!isLikeNone(bigint0), isLikeNone(bigint0) ? BigInt(0) : bigint0);
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
}
/**
* @param {bigint | number | null} [a]
* @returns {bigint | undefined}
*/
export function echo_option_i64(a) {
const bigint0 = typeof a === 'number' ? BigInt(Math.trunc(a)) : a;
const ret = wasm.echo_option_i64(!isLikeNone(bigint0), isLikeNone(bigint0) ? BigInt(0) : bigint0);
return ret[0] === 0 ? undefined : ret[1];
}
/**
* @param {bigint | null} [a]
* @returns {bigint | undefined}
*/
export function echo_option_u128(a) {
const ret = wasm.echo_option_u128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64));
return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64)));
}
/**
* @param {bigint | null} [a]
* @returns {bigint | undefined}
*/
export function echo_option_i128(a) {
const ret = wasm.echo_option_i128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64));
return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (ret[2] << BigInt(64)));
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_usize(a) {
const ret = wasm.echo_option_usize(isLikeNone(a) ? 0x100000001 : (a) >>> 0);
return ret === 0x100000001 ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_isize(a) {
const ret = wasm.echo_option_isize(isLikeNone(a) ? 0x100000001 : (a) >> 0);
return ret === 0x100000001 ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_f32(a) {
const ret = wasm.echo_option_f32(isLikeNone(a) ? 0x100000001 : Math.fround(a));
return ret === 0x100000001 ? undefined : ret;
}
/**
* @param {number | null} [a]
* @returns {number | undefined}
*/
export function echo_option_f64(a) {
const ret = wasm.echo_option_f64(!isLikeNone(a), isLikeNone(a) ? 0 : a);
return ret[0] === 0 ? undefined : ret[1];
}
/**
* @param {boolean | null} [a]
* @returns {boolean | undefined}
*/
export function echo_option_bool(a) {
const ret = wasm.echo_option_bool(isLikeNone(a) ? 0xFFFFFF : a ? 1 : 0);
return ret === 0xFFFFFF ? undefined : ret !== 0;
}
/**
* @param {string | null} [a]
* @returns {string | undefined}
*/
export function echo_option_char(a) {
const char0 = isLikeNone(a) ? 0xFFFFFF : a.codePointAt(0);
if (char0 !== 0xFFFFFF) { _assertChar(char0); }
const ret = wasm.echo_option_char(char0);
return ret === 0xFFFFFF ? undefined : String.fromCodePoint(ret);
}
/**
* @param {string | null} [a]
* @returns {string | undefined}
*/
export function echo_option_string(a) {
var ptr0 = isLikeNone(a) ? 0 : passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_string(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
}
return v2;
}
/**
* @param {Uint8Array | null} [a]
* @returns {Uint8Array | undefined}
*/
export function echo_option_vec_u8(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_u8(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
}
return v2;
}
/**
* @param {Int8Array | null} [a]
* @returns {Int8Array | undefined}
*/
export function echo_option_vec_i8(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_i8(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
}
return v2;
}
/**
* @param {Uint16Array | null} [a]
* @returns {Uint16Array | undefined}
*/
export function echo_option_vec_u16(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_u16(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
}
return v2;
}
/**
* @param {Int16Array | null} [a]
* @returns {Int16Array | undefined}
*/
export function echo_option_vec_i16(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_i16(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
}
return v2;
}
/**
* @param {Uint32Array | null} [a]
* @returns {Uint32Array | undefined}
*/
export function echo_option_vec_u32(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_u32(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
}
return v2;
}
/**
* @param {Int32Array | null} [a]
* @returns {Int32Array | undefined}
*/
export function echo_option_vec_i32(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_i32(ptr0, len0);
let v2;
if (ret[0] !== 0) {
v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
}
return v2;
}
/**
* @param {BigUint64Array | null} [a]
* @returns {BigUint64Array | undefined}
*/
export function echo_option_vec_u64(a) {
var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
const ret = wasm.echo_option_vec_u64(ptr0, len0);
let v2;
if (ret[0] !== 0) {