react-native-ariel 0.1.0-dev.30 → 0.1.0-dev.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2368 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+ #include "mermaid_wrapper.hpp"
4
+
5
+ #include "UniffiJsiTypes.h"
6
+ #include <stdexcept>
7
+ #include <map>
8
+ #include <utility>
9
+ #include <iostream>
10
+ #include <thread>
11
+
12
+ namespace react = facebook::react;
13
+ namespace jsi = facebook::jsi;
14
+
15
+ // Calling into Rust.
16
+ extern "C" {
17
+ typedef void
18
+ (*UniffiRustFutureContinuationCallback)(
19
+ uint64_t data,
20
+ int8_t poll_result
21
+ );
22
+ typedef void
23
+ (*UniffiForeignFutureDroppedCallback)(
24
+ uint64_t handle
25
+ );
26
+ typedef void
27
+ (*UniffiCallbackInterfaceFree)(
28
+ uint64_t handle
29
+ );
30
+ typedef uint64_t
31
+ (*UniffiCallbackInterfaceClone)(
32
+ uint64_t handle
33
+ );typedef struct UniffiForeignFutureDroppedCallbackStruct {
34
+ uint64_t handle;
35
+ UniffiForeignFutureDroppedCallback free;
36
+ } UniffiForeignFutureDroppedCallbackStruct;typedef struct UniffiForeignFutureResultU8 {
37
+ uint8_t return_value;
38
+ RustCallStatus call_status;
39
+ } UniffiForeignFutureResultU8;
40
+ typedef void
41
+ (*UniffiForeignFutureCompleteU8)(
42
+ uint64_t callback_data,
43
+ UniffiForeignFutureResultU8 result
44
+ );typedef struct UniffiForeignFutureResultI8 {
45
+ int8_t return_value;
46
+ RustCallStatus call_status;
47
+ } UniffiForeignFutureResultI8;
48
+ typedef void
49
+ (*UniffiForeignFutureCompleteI8)(
50
+ uint64_t callback_data,
51
+ UniffiForeignFutureResultI8 result
52
+ );typedef struct UniffiForeignFutureResultU16 {
53
+ uint16_t return_value;
54
+ RustCallStatus call_status;
55
+ } UniffiForeignFutureResultU16;
56
+ typedef void
57
+ (*UniffiForeignFutureCompleteU16)(
58
+ uint64_t callback_data,
59
+ UniffiForeignFutureResultU16 result
60
+ );typedef struct UniffiForeignFutureResultI16 {
61
+ int16_t return_value;
62
+ RustCallStatus call_status;
63
+ } UniffiForeignFutureResultI16;
64
+ typedef void
65
+ (*UniffiForeignFutureCompleteI16)(
66
+ uint64_t callback_data,
67
+ UniffiForeignFutureResultI16 result
68
+ );typedef struct UniffiForeignFutureResultU32 {
69
+ uint32_t return_value;
70
+ RustCallStatus call_status;
71
+ } UniffiForeignFutureResultU32;
72
+ typedef void
73
+ (*UniffiForeignFutureCompleteU32)(
74
+ uint64_t callback_data,
75
+ UniffiForeignFutureResultU32 result
76
+ );typedef struct UniffiForeignFutureResultI32 {
77
+ int32_t return_value;
78
+ RustCallStatus call_status;
79
+ } UniffiForeignFutureResultI32;
80
+ typedef void
81
+ (*UniffiForeignFutureCompleteI32)(
82
+ uint64_t callback_data,
83
+ UniffiForeignFutureResultI32 result
84
+ );typedef struct UniffiForeignFutureResultU64 {
85
+ uint64_t return_value;
86
+ RustCallStatus call_status;
87
+ } UniffiForeignFutureResultU64;
88
+ typedef void
89
+ (*UniffiForeignFutureCompleteU64)(
90
+ uint64_t callback_data,
91
+ UniffiForeignFutureResultU64 result
92
+ );typedef struct UniffiForeignFutureResultI64 {
93
+ int64_t return_value;
94
+ RustCallStatus call_status;
95
+ } UniffiForeignFutureResultI64;
96
+ typedef void
97
+ (*UniffiForeignFutureCompleteI64)(
98
+ uint64_t callback_data,
99
+ UniffiForeignFutureResultI64 result
100
+ );typedef struct UniffiForeignFutureResultF32 {
101
+ float return_value;
102
+ RustCallStatus call_status;
103
+ } UniffiForeignFutureResultF32;
104
+ typedef void
105
+ (*UniffiForeignFutureCompleteF32)(
106
+ uint64_t callback_data,
107
+ UniffiForeignFutureResultF32 result
108
+ );typedef struct UniffiForeignFutureResultF64 {
109
+ double return_value;
110
+ RustCallStatus call_status;
111
+ } UniffiForeignFutureResultF64;
112
+ typedef void
113
+ (*UniffiForeignFutureCompleteF64)(
114
+ uint64_t callback_data,
115
+ UniffiForeignFutureResultF64 result
116
+ );typedef struct UniffiForeignFutureResultRustBuffer {
117
+ RustBuffer return_value;
118
+ RustCallStatus call_status;
119
+ } UniffiForeignFutureResultRustBuffer;
120
+ typedef void
121
+ (*UniffiForeignFutureCompleteRustBuffer)(
122
+ uint64_t callback_data,
123
+ UniffiForeignFutureResultRustBuffer result
124
+ );typedef struct UniffiForeignFutureResultVoid {
125
+ RustCallStatus call_status;
126
+ } UniffiForeignFutureResultVoid;
127
+ typedef void
128
+ (*UniffiForeignFutureCompleteVoid)(
129
+ uint64_t callback_data,
130
+ UniffiForeignFutureResultVoid result
131
+ );
132
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_clone_ariellayout(
133
+ /*handle*/ uint64_t handle,
134
+ RustCallStatus *uniffi_out_err
135
+ );
136
+ void uniffi_mermaid_wrapper_fn_free_ariellayout(
137
+ /*handle*/ uint64_t handle,
138
+ RustCallStatus *uniffi_out_err
139
+ );
140
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(
141
+ /*handle*/ uint64_t handle,
142
+ RustCallStatus *uniffi_out_err
143
+ );
144
+ void uniffi_mermaid_wrapper_fn_free_arielparseddiagram(
145
+ /*handle*/ uint64_t handle,
146
+ RustCallStatus *uniffi_out_err
147
+ );
148
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_clone_arieltheme(
149
+ /*handle*/ uint64_t handle,
150
+ RustCallStatus *uniffi_out_err
151
+ );
152
+ void uniffi_mermaid_wrapper_fn_free_arieltheme(
153
+ /*handle*/ uint64_t handle,
154
+ RustCallStatus *uniffi_out_err
155
+ );
156
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(RustCallStatus *uniffi_out_err
157
+ );
158
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(RustCallStatus *uniffi_out_err
159
+ );
160
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(
161
+ /*handle*/ uint64_t parsed,
162
+ /*handle*/ uint64_t theme,
163
+ RustBuffer config,
164
+ RustCallStatus *uniffi_out_err
165
+ );
166
+ /*handle*/ uint64_t uniffi_mermaid_wrapper_fn_func_parse_diagram(
167
+ RustBuffer input,
168
+ RustCallStatus *uniffi_out_err
169
+ );
170
+ RustBuffer uniffi_mermaid_wrapper_fn_func_render_mermaid(
171
+ RustBuffer input,
172
+ RustCallStatus *uniffi_out_err
173
+ );
174
+ RustBuffer uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(
175
+ RustBuffer input,
176
+ /*handle*/ uint64_t _theme,
177
+ RustBuffer _config,
178
+ RustCallStatus *uniffi_out_err
179
+ );
180
+ RustBuffer uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(
181
+ RustBuffer input,
182
+ /*handle*/ uint64_t _theme,
183
+ RustBuffer _config,
184
+ RustCallStatus *uniffi_out_err
185
+ );
186
+ RustBuffer uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(
187
+ /*handle*/ uint64_t layout,
188
+ /*handle*/ uint64_t theme,
189
+ RustBuffer config,
190
+ RustCallStatus *uniffi_out_err
191
+ );
192
+ void uniffi_mermaid_wrapper_fn_func_set_timing_logs(
193
+ int8_t enabled,
194
+ RustCallStatus *uniffi_out_err
195
+ );
196
+ RustBuffer ffi_mermaid_wrapper_rustbuffer_alloc(
197
+ uint64_t size,
198
+ RustCallStatus *uniffi_out_err
199
+ );
200
+ RustBuffer ffi_mermaid_wrapper_rustbuffer_from_bytes(
201
+ ForeignBytes bytes,
202
+ RustCallStatus *uniffi_out_err
203
+ );
204
+ void ffi_mermaid_wrapper_rustbuffer_free(
205
+ RustBuffer buf,
206
+ RustCallStatus *uniffi_out_err
207
+ );
208
+ RustBuffer ffi_mermaid_wrapper_rustbuffer_reserve(
209
+ RustBuffer buf,
210
+ uint64_t additional,
211
+ RustCallStatus *uniffi_out_err
212
+ );
213
+ void ffi_mermaid_wrapper_rust_future_poll_u8(
214
+ /*handle*/ uint64_t handle,
215
+ UniffiRustFutureContinuationCallback callback,
216
+ /*handle*/ uint64_t callback_data
217
+ );
218
+ void ffi_mermaid_wrapper_rust_future_cancel_u8(
219
+ /*handle*/ uint64_t handle
220
+ );
221
+ void ffi_mermaid_wrapper_rust_future_free_u8(
222
+ /*handle*/ uint64_t handle
223
+ );
224
+ uint8_t ffi_mermaid_wrapper_rust_future_complete_u8(
225
+ /*handle*/ uint64_t handle,
226
+ RustCallStatus *uniffi_out_err
227
+ );
228
+ void ffi_mermaid_wrapper_rust_future_poll_i8(
229
+ /*handle*/ uint64_t handle,
230
+ UniffiRustFutureContinuationCallback callback,
231
+ /*handle*/ uint64_t callback_data
232
+ );
233
+ void ffi_mermaid_wrapper_rust_future_cancel_i8(
234
+ /*handle*/ uint64_t handle
235
+ );
236
+ void ffi_mermaid_wrapper_rust_future_free_i8(
237
+ /*handle*/ uint64_t handle
238
+ );
239
+ int8_t ffi_mermaid_wrapper_rust_future_complete_i8(
240
+ /*handle*/ uint64_t handle,
241
+ RustCallStatus *uniffi_out_err
242
+ );
243
+ void ffi_mermaid_wrapper_rust_future_poll_u16(
244
+ /*handle*/ uint64_t handle,
245
+ UniffiRustFutureContinuationCallback callback,
246
+ /*handle*/ uint64_t callback_data
247
+ );
248
+ void ffi_mermaid_wrapper_rust_future_cancel_u16(
249
+ /*handle*/ uint64_t handle
250
+ );
251
+ void ffi_mermaid_wrapper_rust_future_free_u16(
252
+ /*handle*/ uint64_t handle
253
+ );
254
+ uint16_t ffi_mermaid_wrapper_rust_future_complete_u16(
255
+ /*handle*/ uint64_t handle,
256
+ RustCallStatus *uniffi_out_err
257
+ );
258
+ void ffi_mermaid_wrapper_rust_future_poll_i16(
259
+ /*handle*/ uint64_t handle,
260
+ UniffiRustFutureContinuationCallback callback,
261
+ /*handle*/ uint64_t callback_data
262
+ );
263
+ void ffi_mermaid_wrapper_rust_future_cancel_i16(
264
+ /*handle*/ uint64_t handle
265
+ );
266
+ void ffi_mermaid_wrapper_rust_future_free_i16(
267
+ /*handle*/ uint64_t handle
268
+ );
269
+ int16_t ffi_mermaid_wrapper_rust_future_complete_i16(
270
+ /*handle*/ uint64_t handle,
271
+ RustCallStatus *uniffi_out_err
272
+ );
273
+ void ffi_mermaid_wrapper_rust_future_poll_u32(
274
+ /*handle*/ uint64_t handle,
275
+ UniffiRustFutureContinuationCallback callback,
276
+ /*handle*/ uint64_t callback_data
277
+ );
278
+ void ffi_mermaid_wrapper_rust_future_cancel_u32(
279
+ /*handle*/ uint64_t handle
280
+ );
281
+ void ffi_mermaid_wrapper_rust_future_free_u32(
282
+ /*handle*/ uint64_t handle
283
+ );
284
+ uint32_t ffi_mermaid_wrapper_rust_future_complete_u32(
285
+ /*handle*/ uint64_t handle,
286
+ RustCallStatus *uniffi_out_err
287
+ );
288
+ void ffi_mermaid_wrapper_rust_future_poll_i32(
289
+ /*handle*/ uint64_t handle,
290
+ UniffiRustFutureContinuationCallback callback,
291
+ /*handle*/ uint64_t callback_data
292
+ );
293
+ void ffi_mermaid_wrapper_rust_future_cancel_i32(
294
+ /*handle*/ uint64_t handle
295
+ );
296
+ void ffi_mermaid_wrapper_rust_future_free_i32(
297
+ /*handle*/ uint64_t handle
298
+ );
299
+ int32_t ffi_mermaid_wrapper_rust_future_complete_i32(
300
+ /*handle*/ uint64_t handle,
301
+ RustCallStatus *uniffi_out_err
302
+ );
303
+ void ffi_mermaid_wrapper_rust_future_poll_u64(
304
+ /*handle*/ uint64_t handle,
305
+ UniffiRustFutureContinuationCallback callback,
306
+ /*handle*/ uint64_t callback_data
307
+ );
308
+ void ffi_mermaid_wrapper_rust_future_cancel_u64(
309
+ /*handle*/ uint64_t handle
310
+ );
311
+ void ffi_mermaid_wrapper_rust_future_free_u64(
312
+ /*handle*/ uint64_t handle
313
+ );
314
+ uint64_t ffi_mermaid_wrapper_rust_future_complete_u64(
315
+ /*handle*/ uint64_t handle,
316
+ RustCallStatus *uniffi_out_err
317
+ );
318
+ void ffi_mermaid_wrapper_rust_future_poll_i64(
319
+ /*handle*/ uint64_t handle,
320
+ UniffiRustFutureContinuationCallback callback,
321
+ /*handle*/ uint64_t callback_data
322
+ );
323
+ void ffi_mermaid_wrapper_rust_future_cancel_i64(
324
+ /*handle*/ uint64_t handle
325
+ );
326
+ void ffi_mermaid_wrapper_rust_future_free_i64(
327
+ /*handle*/ uint64_t handle
328
+ );
329
+ int64_t ffi_mermaid_wrapper_rust_future_complete_i64(
330
+ /*handle*/ uint64_t handle,
331
+ RustCallStatus *uniffi_out_err
332
+ );
333
+ void ffi_mermaid_wrapper_rust_future_poll_f32(
334
+ /*handle*/ uint64_t handle,
335
+ UniffiRustFutureContinuationCallback callback,
336
+ /*handle*/ uint64_t callback_data
337
+ );
338
+ void ffi_mermaid_wrapper_rust_future_cancel_f32(
339
+ /*handle*/ uint64_t handle
340
+ );
341
+ void ffi_mermaid_wrapper_rust_future_free_f32(
342
+ /*handle*/ uint64_t handle
343
+ );
344
+ float ffi_mermaid_wrapper_rust_future_complete_f32(
345
+ /*handle*/ uint64_t handle,
346
+ RustCallStatus *uniffi_out_err
347
+ );
348
+ void ffi_mermaid_wrapper_rust_future_poll_f64(
349
+ /*handle*/ uint64_t handle,
350
+ UniffiRustFutureContinuationCallback callback,
351
+ /*handle*/ uint64_t callback_data
352
+ );
353
+ void ffi_mermaid_wrapper_rust_future_cancel_f64(
354
+ /*handle*/ uint64_t handle
355
+ );
356
+ void ffi_mermaid_wrapper_rust_future_free_f64(
357
+ /*handle*/ uint64_t handle
358
+ );
359
+ double ffi_mermaid_wrapper_rust_future_complete_f64(
360
+ /*handle*/ uint64_t handle,
361
+ RustCallStatus *uniffi_out_err
362
+ );
363
+ void ffi_mermaid_wrapper_rust_future_poll_rust_buffer(
364
+ /*handle*/ uint64_t handle,
365
+ UniffiRustFutureContinuationCallback callback,
366
+ /*handle*/ uint64_t callback_data
367
+ );
368
+ void ffi_mermaid_wrapper_rust_future_cancel_rust_buffer(
369
+ /*handle*/ uint64_t handle
370
+ );
371
+ void ffi_mermaid_wrapper_rust_future_free_rust_buffer(
372
+ /*handle*/ uint64_t handle
373
+ );
374
+ RustBuffer ffi_mermaid_wrapper_rust_future_complete_rust_buffer(
375
+ /*handle*/ uint64_t handle,
376
+ RustCallStatus *uniffi_out_err
377
+ );
378
+ void ffi_mermaid_wrapper_rust_future_poll_void(
379
+ /*handle*/ uint64_t handle,
380
+ UniffiRustFutureContinuationCallback callback,
381
+ /*handle*/ uint64_t callback_data
382
+ );
383
+ void ffi_mermaid_wrapper_rust_future_cancel_void(
384
+ /*handle*/ uint64_t handle
385
+ );
386
+ void ffi_mermaid_wrapper_rust_future_free_void(
387
+ /*handle*/ uint64_t handle
388
+ );
389
+ void ffi_mermaid_wrapper_rust_future_complete_void(
390
+ /*handle*/ uint64_t handle,
391
+ RustCallStatus *uniffi_out_err
392
+ );
393
+ uint16_t uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout(
394
+ );
395
+ uint16_t uniffi_mermaid_wrapper_checksum_func_parse_diagram(
396
+ );
397
+ uint16_t uniffi_mermaid_wrapper_checksum_func_render_mermaid(
398
+ );
399
+ uint16_t uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options(
400
+ );
401
+ uint16_t uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing(
402
+ );
403
+ uint16_t uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout(
404
+ );
405
+ uint16_t uniffi_mermaid_wrapper_checksum_func_set_timing_logs(
406
+ );
407
+ uint16_t uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default(
408
+ );
409
+ uint16_t uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern(
410
+ );
411
+ uint32_t ffi_mermaid_wrapper_uniffi_contract_version(
412
+ );
413
+ }
414
+
415
+
416
+ namespace uniffi::mermaid_wrapper {
417
+ template <typename T> struct Bridging;
418
+
419
+ using namespace facebook;
420
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
421
+
422
+ template <typename T> struct Bridging<ReferenceHolder<T>> {
423
+ static jsi::Value jsNew(jsi::Runtime &rt) {
424
+ auto holder = jsi::Object(rt);
425
+ return holder;
426
+ }
427
+ static T fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
428
+ const jsi::Value &value) {
429
+ auto obj = value.asObject(rt);
430
+ if (obj.hasProperty(rt, "pointee")) {
431
+ auto pointee = obj.getProperty(rt, "pointee");
432
+ return uniffi::mermaid_wrapper::Bridging<T>::fromJs(rt, callInvoker, pointee);
433
+ }
434
+ throw jsi::JSError(
435
+ rt,
436
+ "Expected ReferenceHolder to have a pointee property. This is likely a bug in uniffi-bindgen-react-native"
437
+ );
438
+ }
439
+ };
440
+ } // namespace uniffi::mermaid_wrapper
441
+ namespace uniffi::mermaid_wrapper {
442
+ using namespace facebook;
443
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
444
+
445
+ template <> struct Bridging<RustBuffer> {
446
+ static RustBuffer rustbuffer_alloc(int32_t size) {
447
+ RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
448
+ return ffi_mermaid_wrapper_rustbuffer_alloc(
449
+ size,
450
+ &status
451
+ );
452
+ }
453
+
454
+ static void rustbuffer_free(RustBuffer buf) {
455
+ RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
456
+ ffi_mermaid_wrapper_rustbuffer_free(
457
+ buf,
458
+ &status
459
+ );
460
+ }
461
+
462
+ static RustBuffer rustbuffer_from_bytes(ForeignBytes bytes) {
463
+ RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
464
+ return ffi_mermaid_wrapper_rustbuffer_from_bytes(
465
+ bytes,
466
+ &status
467
+ );
468
+ }
469
+
470
+ static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
471
+ const jsi::Value &value) {
472
+ try {
473
+ auto buffer = uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt, value);
474
+ auto bytes = ForeignBytes{
475
+ .len = static_cast<int32_t>(buffer.length(rt)),
476
+ .data = buffer.data(rt),
477
+ };
478
+
479
+ // This buffer is constructed from foreign bytes. Rust scaffolding copies
480
+ // the bytes, to make the RustBuffer.
481
+ auto buf = rustbuffer_from_bytes(bytes);
482
+ // Once it leaves this function, the buffer is immediately passed back
483
+ // into Rust, where it's used to deserialize into the Rust versions of the
484
+ // arguments. At that point, the copy is destroyed.
485
+ return buf;
486
+ } catch (const std::logic_error &e) {
487
+ throw jsi::JSError(rt, e.what());
488
+ }
489
+ }
490
+
491
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
492
+ RustBuffer buf) {
493
+ // We need to make a copy of the bytes from Rust's memory space into
494
+ // Javascripts memory space. We need to do this because the two languages
495
+ // manages memory very differently: a garbage collector needs to track all
496
+ // the memory at runtime, Rust is doing it all closer to compile time.
497
+ uint8_t *bytes = new uint8_t[buf.len];
498
+ std::memcpy(bytes, buf.data, buf.len);
499
+
500
+ // Construct an ArrayBuffer with copy of the bytes from the RustBuffer.
501
+ auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(
502
+ uniffi_jsi::CMutableBuffer((uint8_t *)bytes, buf.len));
503
+ auto arrayBuffer = jsi::ArrayBuffer(rt, payload);
504
+
505
+ // Once we have a Javascript version, we no longer need the Rust version, so
506
+ // we can call into Rust to tell it it's okay to free that memory.
507
+ rustbuffer_free(buf);
508
+
509
+ // Finally, return the ArrayBuffer.
510
+ return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(rt, arrayBuffer);;
511
+ }
512
+ };
513
+
514
+ } // namespace uniffi::mermaid_wrapper
515
+
516
+ namespace uniffi::mermaid_wrapper {
517
+ using namespace facebook;
518
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
519
+
520
+ template <> struct Bridging<RustCallStatus> {
521
+ static jsi::Value jsSuccess(jsi::Runtime &rt) {
522
+ auto statusObject = jsi::Object(rt);
523
+ statusObject.setProperty(rt, "code", jsi::Value(rt, UNIFFI_CALL_STATUS_OK));
524
+ return statusObject;
525
+ }
526
+ static RustCallStatus rustSuccess(jsi::Runtime &rt) {
527
+ return {UNIFFI_CALL_STATUS_OK};
528
+ }
529
+ static void copyIntoJs(jsi::Runtime &rt,
530
+ std::shared_ptr<CallInvoker> callInvoker,
531
+ const RustCallStatus status,
532
+ const jsi::Value &jsStatus) {
533
+ auto statusObject = jsStatus.asObject(rt);
534
+ if (status.error_buf.data != nullptr) {
535
+ auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker,
536
+ status.error_buf);
537
+ statusObject.setProperty(rt, "errorBuf", rbuf);
538
+ }
539
+ if (status.code != UNIFFI_CALL_STATUS_OK) {
540
+ auto code =
541
+ uniffi_jsi::Bridging<uint8_t>::toJs(rt, callInvoker, status.code);
542
+ statusObject.setProperty(rt, "code", code);
543
+ }
544
+ }
545
+
546
+ static RustCallStatus fromJs(jsi::Runtime &rt,
547
+ std::shared_ptr<CallInvoker> invoker,
548
+ const jsi::Value &jsStatus) {
549
+ RustCallStatus status;
550
+ auto statusObject = jsStatus.asObject(rt);
551
+ if (statusObject.hasProperty(rt, "errorBuf")) {
552
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
553
+ status.error_buf =
554
+ Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
555
+ }
556
+ if (statusObject.hasProperty(rt, "code")) {
557
+ auto code = statusObject.getProperty(rt, "code");
558
+ status.code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
559
+ }
560
+ return status;
561
+ }
562
+
563
+ static void copyFromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> invoker,
564
+ const jsi::Value &jsStatus, RustCallStatus *status) {
565
+ auto statusObject = jsStatus.asObject(rt);
566
+ if (statusObject.hasProperty(rt, "errorBuf")) {
567
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
568
+ status->error_buf =
569
+ Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
570
+ }
571
+ if (statusObject.hasProperty(rt, "code")) {
572
+ auto code = statusObject.getProperty(rt, "code");
573
+ status->code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
574
+ }
575
+ }
576
+ };
577
+
578
+ } // namespace uniffi::mermaid_wrapper
579
+ // In other uniffi bindings, it is assumed that the foreign language holds on
580
+ // to the vtable, which the Rust just gets a pointer to.
581
+ // Here, we need to hold on to them, but also be able to clear them at just the
582
+ // right time so we can support hot-reloading.
583
+ namespace uniffi::mermaid_wrapper::registry {
584
+ template <typename T>
585
+ class VTableHolder {
586
+ public:
587
+ T vtable;
588
+ VTableHolder(T v) : vtable(v) {}
589
+ };
590
+
591
+ // Mutex to bind the storage and setting of vtable together.
592
+ // We declare it here, but the lock is taken by callers of the putTable
593
+ // method who are also sending a pointer to Rust.
594
+ static std::mutex vtableMutex;
595
+
596
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
597
+ // The only reason this exists is to prevent a dangling pointer in the
598
+ // Rust machinery: i.e. we don't need to access or write to this registry
599
+ // after startup.
600
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
601
+ // Maps string identifiers to vtable holders using type erasure
602
+ static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
603
+
604
+ // Add a vtable to the registry with an identifier
605
+ template <typename T>
606
+ static T* putTable(std::string_view identifier, T vtable) {
607
+ auto holder = std::make_shared<VTableHolder<T>>(vtable);
608
+ // Store the raw pointer to the vtable before type erasure
609
+ T* rawPtr = &(holder->vtable);
610
+ // Store the holder using type erasure with the string identifier
611
+ vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
612
+ return rawPtr;
613
+ }
614
+
615
+ // Clear the registry.
616
+ //
617
+ // Conceptually, this is called after teardown of the module (i.e. after
618
+ // teardown of the jsi::Runtime). However, because Rust is dropping callbacks
619
+ // because the Runtime is being torn down, we must keep the registry intact
620
+ // until after the runtime goes away.
621
+ //
622
+ // Therefore, in practice we should call this when the next runtime is
623
+ // being stood up.
624
+ static void clearRegistry() {
625
+ std::lock_guard<std::mutex> lock(vtableMutex);
626
+ vtableRegistry.clear();
627
+ }
628
+ } // namespace uniffi::mermaid_wrapper::registry
629
+
630
+ // This calls into Rust.
631
+ // Implementation of callback function calling from Rust to JS RustFutureContinuationCallback
632
+
633
+ // Callback function: uniffi::mermaid_wrapper::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
634
+ //
635
+ // We have the following constraints:
636
+ // - we need to pass a function pointer to Rust.
637
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
638
+ // - function pointers can't store state, so we can't use a lamda.
639
+ //
640
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
641
+ // the lambda, which itself calls the `body` which then calls into JS.
642
+ //
643
+ // We then give the `callback` function pointer to Rust which will call the lambda sometime in the
644
+ // future.
645
+ namespace uniffi::mermaid_wrapper::cb::rustfuturecontinuationcallback {
646
+ using namespace facebook;
647
+
648
+ // We need to store a lambda in a global so we can call it from
649
+ // a function pointer. The function pointer is passed to Rust.
650
+ static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
651
+
652
+ // This is the main body of the callback. It's called from the lambda,
653
+ // which itself is called from the callback function which is passed to Rust.
654
+ static void body(jsi::Runtime &rt,
655
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
656
+ std::shared_ptr<jsi::Value> callbackValue
657
+ ,uint64_t rs_data
658
+ ,int8_t rs_pollResult) {
659
+
660
+ // Convert the arguments from Rust, into jsi::Values.
661
+ // We'll use the Bridging class to do this…
662
+ auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
663
+ auto js_pollResult = uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
664
+
665
+ // Now we are ready to call the callback.
666
+ // We are already on the JS thread, because this `body` function was
667
+ // invoked from the CallInvoker.
668
+ try {
669
+ // Getting the callback function
670
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
671
+ auto uniffiResult = cb.call(rt, js_data, js_pollResult
672
+ );
673
+
674
+
675
+
676
+
677
+ } catch (const jsi::JSError &error) {
678
+ std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
679
+ << error.what() << std::endl;
680
+ throw error;
681
+ }
682
+ }
683
+
684
+ static void callback(uint64_t rs_data, int8_t rs_pollResult) {
685
+ // If the runtime has shutdown, then there is no point in trying to
686
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
687
+ //
688
+ // Answer: the module destructor calls into callback `cleanup` method,
689
+ // which nulls out the rsLamda.
690
+ //
691
+ // If rsLamda is null, then there is no runtime to call into.
692
+ if (rsLambda == nullptr) {
693
+ // This only occurs when destructors are calling into Rust free/drop,
694
+ // which causes the JS callback to be dropped.
695
+ return;
696
+ }
697
+
698
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
699
+ // are all in the lambda.
700
+ rsLambda(
701
+ rs_data,
702
+ rs_pollResult);
703
+ }
704
+
705
+ [[maybe_unused]] static UniffiRustFutureContinuationCallback
706
+ makeCallbackFunction( // uniffi::mermaid_wrapper::cb::rustfuturecontinuationcallback
707
+ jsi::Runtime &rt,
708
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
709
+ const jsi::Value &value) {
710
+ if (rsLambda != nullptr) {
711
+ // `makeCallbackFunction` is called in two circumstances:
712
+ //
713
+ // 1. at startup, when initializing callback interface vtables.
714
+ // 2. when polling futures. This happens at least once per future that is
715
+ // exposed to Javascript. We know that this is always the same function,
716
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
717
+ //
718
+ // We can therefore return the callback function without making anything
719
+ // new if we've been initialized already.
720
+ return callback;
721
+ }
722
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
723
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
724
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_data, int8_t rs_pollResult) {
725
+ // We immediately make a lambda which will do the work of transforming the
726
+ // arguments into JSI values and calling the callback.
727
+ uniffi_runtime::UniffiCallFunc jsLambda = [
728
+ callInvoker,
729
+ callbackValue
730
+ , rs_data
731
+ , rs_pollResult](jsi::Runtime &rt) mutable {
732
+ body(rt, callInvoker, callbackValue
733
+ , rs_data
734
+ , rs_pollResult);
735
+ };
736
+ // We'll then call that lambda from the callInvoker which will
737
+ // look after calling it on the correct thread.
738
+
739
+ callInvoker->invokeNonBlocking(rt, jsLambda);
740
+ };
741
+ return callback;
742
+ }
743
+
744
+ // This method is called from the destructor of NativeMermaidWrapper, which only happens
745
+ // when the jsi::Runtime is being destroyed.
746
+ static void cleanup() {
747
+ // The lambda holds a reference to the the Runtime, so when this is nulled out,
748
+ // then the pointer will no longer be left dangling.
749
+ rsLambda = nullptr;
750
+ }
751
+ } // namespace uniffi::mermaid_wrapper::cb::rustfuturecontinuationcallback
752
+ // Implementation of callback function calling from Rust to JS ForeignFutureDroppedCallback
753
+
754
+ // Callback function: uniffi::mermaid_wrapper::cb::foreignfuturedroppedcallback::UniffiForeignFutureDroppedCallback
755
+ //
756
+ // We have the following constraints:
757
+ // - we need to pass a function pointer to Rust.
758
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
759
+ // - function pointers can't store state, so we can't use a lamda.
760
+ //
761
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
762
+ // the lambda, which itself calls the `body` which then calls into JS.
763
+ //
764
+ // We then give the `callback` function pointer to Rust which will call the lambda sometime in the
765
+ // future.
766
+ namespace uniffi::mermaid_wrapper::cb::foreignfuturedroppedcallback {
767
+ using namespace facebook;
768
+
769
+ // We need to store a lambda in a global so we can call it from
770
+ // a function pointer. The function pointer is passed to Rust.
771
+ static std::function<void(uint64_t)> rsLambda = nullptr;
772
+
773
+ // This is the main body of the callback. It's called from the lambda,
774
+ // which itself is called from the callback function which is passed to Rust.
775
+ static void body(jsi::Runtime &rt,
776
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
777
+ std::shared_ptr<jsi::Value> callbackValue
778
+ ,uint64_t rs_handle) {
779
+
780
+ // Convert the arguments from Rust, into jsi::Values.
781
+ // We'll use the Bridging class to do this…
782
+ auto js_handle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
783
+
784
+ // Now we are ready to call the callback.
785
+ // We are already on the JS thread, because this `body` function was
786
+ // invoked from the CallInvoker.
787
+ try {
788
+ // Getting the callback function
789
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
790
+ auto uniffiResult = cb.call(rt, js_handle
791
+ );
792
+
793
+
794
+
795
+
796
+ } catch (const jsi::JSError &error) {
797
+ std::cout << "Error in callback UniffiForeignFutureDroppedCallback: "
798
+ << error.what() << std::endl;
799
+ throw error;
800
+ }
801
+ }
802
+
803
+ static void callback(uint64_t rs_handle) {
804
+ // If the runtime has shutdown, then there is no point in trying to
805
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
806
+ //
807
+ // Answer: the module destructor calls into callback `cleanup` method,
808
+ // which nulls out the rsLamda.
809
+ //
810
+ // If rsLamda is null, then there is no runtime to call into.
811
+ if (rsLambda == nullptr) {
812
+ // This only occurs when destructors are calling into Rust free/drop,
813
+ // which causes the JS callback to be dropped.
814
+ return;
815
+ }
816
+
817
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
818
+ // are all in the lambda.
819
+ rsLambda(
820
+ rs_handle);
821
+ }
822
+
823
+ [[maybe_unused]] static UniffiForeignFutureDroppedCallback
824
+ makeCallbackFunction( // uniffi::mermaid_wrapper::cb::foreignfuturedroppedcallback
825
+ jsi::Runtime &rt,
826
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
827
+ const jsi::Value &value) {
828
+ if (rsLambda != nullptr) {
829
+ // `makeCallbackFunction` is called in two circumstances:
830
+ //
831
+ // 1. at startup, when initializing callback interface vtables.
832
+ // 2. when polling futures. This happens at least once per future that is
833
+ // exposed to Javascript. We know that this is always the same function,
834
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
835
+ //
836
+ // We can therefore return the callback function without making anything
837
+ // new if we've been initialized already.
838
+ return callback;
839
+ }
840
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
841
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
842
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
843
+ // We immediately make a lambda which will do the work of transforming the
844
+ // arguments into JSI values and calling the callback.
845
+ uniffi_runtime::UniffiCallFunc jsLambda = [
846
+ callInvoker,
847
+ callbackValue
848
+ , rs_handle](jsi::Runtime &rt) mutable {
849
+ body(rt, callInvoker, callbackValue
850
+ , rs_handle);
851
+ };
852
+ // We'll then call that lambda from the callInvoker which will
853
+ // look after calling it on the correct thread.
854
+
855
+ callInvoker->invokeNonBlocking(rt, jsLambda);
856
+ };
857
+ return callback;
858
+ }
859
+
860
+ // This method is called from the destructor of NativeMermaidWrapper, which only happens
861
+ // when the jsi::Runtime is being destroyed.
862
+ static void cleanup() {
863
+ // The lambda holds a reference to the the Runtime, so when this is nulled out,
864
+ // then the pointer will no longer be left dangling.
865
+ rsLambda = nullptr;
866
+ }
867
+ } // namespace uniffi::mermaid_wrapper::cb::foreignfuturedroppedcallback
868
+ // Implementation of free callback function CallbackInterfaceFree
869
+
870
+ namespace uniffi::mermaid_wrapper {
871
+ using namespace facebook;
872
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
873
+
874
+ template <> struct Bridging<UniffiForeignFutureDroppedCallbackStruct> {
875
+ static UniffiForeignFutureDroppedCallbackStruct fromJs(jsi::Runtime &rt,
876
+ std::shared_ptr<CallInvoker> callInvoker,
877
+ const jsi::Value &jsValue
878
+ ) {
879
+ // Check if the input is an object
880
+ if (!jsValue.isObject()) {
881
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureDroppedCallbackStruct");
882
+ }
883
+
884
+ // Get the object from the jsi::Value
885
+ auto jsObject = jsValue.getObject(rt);
886
+
887
+ // Create the vtable struct
888
+ UniffiForeignFutureDroppedCallbackStruct rsObject;
889
+
890
+ // Create the vtable from the js callbacks.
891
+ rsObject.handle = uniffi_jsi::Bridging<uint64_t>::fromJs(
892
+ rt, callInvoker,
893
+ jsObject.getProperty(rt, "handle")
894
+ );
895
+ rsObject.free = uniffi::mermaid_wrapper::cb::foreignfuturedroppedcallback::makeCallbackFunction(
896
+ rt, callInvoker, jsObject.getProperty(rt, "free")
897
+ );
898
+
899
+ return rsObject;
900
+ }
901
+ };
902
+
903
+ } // namespace uniffi::mermaid_wrapper
904
+ namespace uniffi::mermaid_wrapper {
905
+ using namespace facebook;
906
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
907
+
908
+ template <> struct Bridging<UniffiForeignFutureResultU8> {
909
+ static UniffiForeignFutureResultU8 fromJs(jsi::Runtime &rt,
910
+ std::shared_ptr<CallInvoker> callInvoker,
911
+ const jsi::Value &jsValue
912
+ ) {
913
+ // Check if the input is an object
914
+ if (!jsValue.isObject()) {
915
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultU8");
916
+ }
917
+
918
+ // Get the object from the jsi::Value
919
+ auto jsObject = jsValue.getObject(rt);
920
+
921
+ // Create the vtable struct
922
+ UniffiForeignFutureResultU8 rsObject;
923
+
924
+ // Create the vtable from the js callbacks.
925
+ rsObject.return_value = uniffi_jsi::Bridging<uint8_t>::fromJs(
926
+ rt, callInvoker,
927
+ jsObject.getProperty(rt, "returnValue")
928
+ );
929
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
930
+ rt, callInvoker,
931
+ jsObject.getProperty(rt, "callStatus")
932
+ );
933
+
934
+ return rsObject;
935
+ }
936
+ };
937
+
938
+ } // namespace uniffi::mermaid_wrapper
939
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU8,
940
+ // passed from Rust to JS as part of async callbacks.
941
+ namespace uniffi::mermaid_wrapper {
942
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
943
+
944
+ template <> struct Bridging<UniffiForeignFutureCompleteU8> {
945
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU8 rsCallback) {
946
+ return jsi::Function::createFromHostFunction(
947
+ rt,
948
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU8"),
949
+ 2,
950
+ [rsCallback, callInvoker](
951
+ jsi::Runtime &rt,
952
+ const jsi::Value &thisValue,
953
+ const jsi::Value *arguments,
954
+ size_t count) -> jsi::Value
955
+ {
956
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
957
+ }
958
+ );
959
+ }
960
+
961
+ static jsi::Value intoRust(
962
+ jsi::Runtime &rt,
963
+ std::shared_ptr<CallInvoker> callInvoker,
964
+ const jsi::Value &thisValue,
965
+ const jsi::Value *args,
966
+ size_t count,
967
+ UniffiForeignFutureCompleteU8 func) {
968
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
969
+ // then call the rs_callback with those arguments.
970
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultU8>::fromJs(rt, callInvoker, args[1])
971
+ );
972
+
973
+
974
+ return jsi::Value::undefined();
975
+ }
976
+ };
977
+ } // namespace uniffi::mermaid_wrapper
978
+ namespace uniffi::mermaid_wrapper {
979
+ using namespace facebook;
980
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
981
+
982
+ template <> struct Bridging<UniffiForeignFutureResultI8> {
983
+ static UniffiForeignFutureResultI8 fromJs(jsi::Runtime &rt,
984
+ std::shared_ptr<CallInvoker> callInvoker,
985
+ const jsi::Value &jsValue
986
+ ) {
987
+ // Check if the input is an object
988
+ if (!jsValue.isObject()) {
989
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultI8");
990
+ }
991
+
992
+ // Get the object from the jsi::Value
993
+ auto jsObject = jsValue.getObject(rt);
994
+
995
+ // Create the vtable struct
996
+ UniffiForeignFutureResultI8 rsObject;
997
+
998
+ // Create the vtable from the js callbacks.
999
+ rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
1000
+ rt, callInvoker,
1001
+ jsObject.getProperty(rt, "returnValue")
1002
+ );
1003
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1004
+ rt, callInvoker,
1005
+ jsObject.getProperty(rt, "callStatus")
1006
+ );
1007
+
1008
+ return rsObject;
1009
+ }
1010
+ };
1011
+
1012
+ } // namespace uniffi::mermaid_wrapper
1013
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI8,
1014
+ // passed from Rust to JS as part of async callbacks.
1015
+ namespace uniffi::mermaid_wrapper {
1016
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1017
+
1018
+ template <> struct Bridging<UniffiForeignFutureCompleteI8> {
1019
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI8 rsCallback) {
1020
+ return jsi::Function::createFromHostFunction(
1021
+ rt,
1022
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI8"),
1023
+ 2,
1024
+ [rsCallback, callInvoker](
1025
+ jsi::Runtime &rt,
1026
+ const jsi::Value &thisValue,
1027
+ const jsi::Value *arguments,
1028
+ size_t count) -> jsi::Value
1029
+ {
1030
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1031
+ }
1032
+ );
1033
+ }
1034
+
1035
+ static jsi::Value intoRust(
1036
+ jsi::Runtime &rt,
1037
+ std::shared_ptr<CallInvoker> callInvoker,
1038
+ const jsi::Value &thisValue,
1039
+ const jsi::Value *args,
1040
+ size_t count,
1041
+ UniffiForeignFutureCompleteI8 func) {
1042
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1043
+ // then call the rs_callback with those arguments.
1044
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultI8>::fromJs(rt, callInvoker, args[1])
1045
+ );
1046
+
1047
+
1048
+ return jsi::Value::undefined();
1049
+ }
1050
+ };
1051
+ } // namespace uniffi::mermaid_wrapper
1052
+ namespace uniffi::mermaid_wrapper {
1053
+ using namespace facebook;
1054
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1055
+
1056
+ template <> struct Bridging<UniffiForeignFutureResultU16> {
1057
+ static UniffiForeignFutureResultU16 fromJs(jsi::Runtime &rt,
1058
+ std::shared_ptr<CallInvoker> callInvoker,
1059
+ const jsi::Value &jsValue
1060
+ ) {
1061
+ // Check if the input is an object
1062
+ if (!jsValue.isObject()) {
1063
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultU16");
1064
+ }
1065
+
1066
+ // Get the object from the jsi::Value
1067
+ auto jsObject = jsValue.getObject(rt);
1068
+
1069
+ // Create the vtable struct
1070
+ UniffiForeignFutureResultU16 rsObject;
1071
+
1072
+ // Create the vtable from the js callbacks.
1073
+ rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
1074
+ rt, callInvoker,
1075
+ jsObject.getProperty(rt, "returnValue")
1076
+ );
1077
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1078
+ rt, callInvoker,
1079
+ jsObject.getProperty(rt, "callStatus")
1080
+ );
1081
+
1082
+ return rsObject;
1083
+ }
1084
+ };
1085
+
1086
+ } // namespace uniffi::mermaid_wrapper
1087
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU16,
1088
+ // passed from Rust to JS as part of async callbacks.
1089
+ namespace uniffi::mermaid_wrapper {
1090
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1091
+
1092
+ template <> struct Bridging<UniffiForeignFutureCompleteU16> {
1093
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU16 rsCallback) {
1094
+ return jsi::Function::createFromHostFunction(
1095
+ rt,
1096
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU16"),
1097
+ 2,
1098
+ [rsCallback, callInvoker](
1099
+ jsi::Runtime &rt,
1100
+ const jsi::Value &thisValue,
1101
+ const jsi::Value *arguments,
1102
+ size_t count) -> jsi::Value
1103
+ {
1104
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1105
+ }
1106
+ );
1107
+ }
1108
+
1109
+ static jsi::Value intoRust(
1110
+ jsi::Runtime &rt,
1111
+ std::shared_ptr<CallInvoker> callInvoker,
1112
+ const jsi::Value &thisValue,
1113
+ const jsi::Value *args,
1114
+ size_t count,
1115
+ UniffiForeignFutureCompleteU16 func) {
1116
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1117
+ // then call the rs_callback with those arguments.
1118
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultU16>::fromJs(rt, callInvoker, args[1])
1119
+ );
1120
+
1121
+
1122
+ return jsi::Value::undefined();
1123
+ }
1124
+ };
1125
+ } // namespace uniffi::mermaid_wrapper
1126
+ namespace uniffi::mermaid_wrapper {
1127
+ using namespace facebook;
1128
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1129
+
1130
+ template <> struct Bridging<UniffiForeignFutureResultI16> {
1131
+ static UniffiForeignFutureResultI16 fromJs(jsi::Runtime &rt,
1132
+ std::shared_ptr<CallInvoker> callInvoker,
1133
+ const jsi::Value &jsValue
1134
+ ) {
1135
+ // Check if the input is an object
1136
+ if (!jsValue.isObject()) {
1137
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultI16");
1138
+ }
1139
+
1140
+ // Get the object from the jsi::Value
1141
+ auto jsObject = jsValue.getObject(rt);
1142
+
1143
+ // Create the vtable struct
1144
+ UniffiForeignFutureResultI16 rsObject;
1145
+
1146
+ // Create the vtable from the js callbacks.
1147
+ rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
1148
+ rt, callInvoker,
1149
+ jsObject.getProperty(rt, "returnValue")
1150
+ );
1151
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1152
+ rt, callInvoker,
1153
+ jsObject.getProperty(rt, "callStatus")
1154
+ );
1155
+
1156
+ return rsObject;
1157
+ }
1158
+ };
1159
+
1160
+ } // namespace uniffi::mermaid_wrapper
1161
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI16,
1162
+ // passed from Rust to JS as part of async callbacks.
1163
+ namespace uniffi::mermaid_wrapper {
1164
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1165
+
1166
+ template <> struct Bridging<UniffiForeignFutureCompleteI16> {
1167
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI16 rsCallback) {
1168
+ return jsi::Function::createFromHostFunction(
1169
+ rt,
1170
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI16"),
1171
+ 2,
1172
+ [rsCallback, callInvoker](
1173
+ jsi::Runtime &rt,
1174
+ const jsi::Value &thisValue,
1175
+ const jsi::Value *arguments,
1176
+ size_t count) -> jsi::Value
1177
+ {
1178
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1179
+ }
1180
+ );
1181
+ }
1182
+
1183
+ static jsi::Value intoRust(
1184
+ jsi::Runtime &rt,
1185
+ std::shared_ptr<CallInvoker> callInvoker,
1186
+ const jsi::Value &thisValue,
1187
+ const jsi::Value *args,
1188
+ size_t count,
1189
+ UniffiForeignFutureCompleteI16 func) {
1190
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1191
+ // then call the rs_callback with those arguments.
1192
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultI16>::fromJs(rt, callInvoker, args[1])
1193
+ );
1194
+
1195
+
1196
+ return jsi::Value::undefined();
1197
+ }
1198
+ };
1199
+ } // namespace uniffi::mermaid_wrapper
1200
+ namespace uniffi::mermaid_wrapper {
1201
+ using namespace facebook;
1202
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1203
+
1204
+ template <> struct Bridging<UniffiForeignFutureResultU32> {
1205
+ static UniffiForeignFutureResultU32 fromJs(jsi::Runtime &rt,
1206
+ std::shared_ptr<CallInvoker> callInvoker,
1207
+ const jsi::Value &jsValue
1208
+ ) {
1209
+ // Check if the input is an object
1210
+ if (!jsValue.isObject()) {
1211
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultU32");
1212
+ }
1213
+
1214
+ // Get the object from the jsi::Value
1215
+ auto jsObject = jsValue.getObject(rt);
1216
+
1217
+ // Create the vtable struct
1218
+ UniffiForeignFutureResultU32 rsObject;
1219
+
1220
+ // Create the vtable from the js callbacks.
1221
+ rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
1222
+ rt, callInvoker,
1223
+ jsObject.getProperty(rt, "returnValue")
1224
+ );
1225
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1226
+ rt, callInvoker,
1227
+ jsObject.getProperty(rt, "callStatus")
1228
+ );
1229
+
1230
+ return rsObject;
1231
+ }
1232
+ };
1233
+
1234
+ } // namespace uniffi::mermaid_wrapper
1235
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU32,
1236
+ // passed from Rust to JS as part of async callbacks.
1237
+ namespace uniffi::mermaid_wrapper {
1238
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1239
+
1240
+ template <> struct Bridging<UniffiForeignFutureCompleteU32> {
1241
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU32 rsCallback) {
1242
+ return jsi::Function::createFromHostFunction(
1243
+ rt,
1244
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU32"),
1245
+ 2,
1246
+ [rsCallback, callInvoker](
1247
+ jsi::Runtime &rt,
1248
+ const jsi::Value &thisValue,
1249
+ const jsi::Value *arguments,
1250
+ size_t count) -> jsi::Value
1251
+ {
1252
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1253
+ }
1254
+ );
1255
+ }
1256
+
1257
+ static jsi::Value intoRust(
1258
+ jsi::Runtime &rt,
1259
+ std::shared_ptr<CallInvoker> callInvoker,
1260
+ const jsi::Value &thisValue,
1261
+ const jsi::Value *args,
1262
+ size_t count,
1263
+ UniffiForeignFutureCompleteU32 func) {
1264
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1265
+ // then call the rs_callback with those arguments.
1266
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultU32>::fromJs(rt, callInvoker, args[1])
1267
+ );
1268
+
1269
+
1270
+ return jsi::Value::undefined();
1271
+ }
1272
+ };
1273
+ } // namespace uniffi::mermaid_wrapper
1274
+ namespace uniffi::mermaid_wrapper {
1275
+ using namespace facebook;
1276
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1277
+
1278
+ template <> struct Bridging<UniffiForeignFutureResultI32> {
1279
+ static UniffiForeignFutureResultI32 fromJs(jsi::Runtime &rt,
1280
+ std::shared_ptr<CallInvoker> callInvoker,
1281
+ const jsi::Value &jsValue
1282
+ ) {
1283
+ // Check if the input is an object
1284
+ if (!jsValue.isObject()) {
1285
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultI32");
1286
+ }
1287
+
1288
+ // Get the object from the jsi::Value
1289
+ auto jsObject = jsValue.getObject(rt);
1290
+
1291
+ // Create the vtable struct
1292
+ UniffiForeignFutureResultI32 rsObject;
1293
+
1294
+ // Create the vtable from the js callbacks.
1295
+ rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
1296
+ rt, callInvoker,
1297
+ jsObject.getProperty(rt, "returnValue")
1298
+ );
1299
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1300
+ rt, callInvoker,
1301
+ jsObject.getProperty(rt, "callStatus")
1302
+ );
1303
+
1304
+ return rsObject;
1305
+ }
1306
+ };
1307
+
1308
+ } // namespace uniffi::mermaid_wrapper
1309
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI32,
1310
+ // passed from Rust to JS as part of async callbacks.
1311
+ namespace uniffi::mermaid_wrapper {
1312
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1313
+
1314
+ template <> struct Bridging<UniffiForeignFutureCompleteI32> {
1315
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI32 rsCallback) {
1316
+ return jsi::Function::createFromHostFunction(
1317
+ rt,
1318
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI32"),
1319
+ 2,
1320
+ [rsCallback, callInvoker](
1321
+ jsi::Runtime &rt,
1322
+ const jsi::Value &thisValue,
1323
+ const jsi::Value *arguments,
1324
+ size_t count) -> jsi::Value
1325
+ {
1326
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1327
+ }
1328
+ );
1329
+ }
1330
+
1331
+ static jsi::Value intoRust(
1332
+ jsi::Runtime &rt,
1333
+ std::shared_ptr<CallInvoker> callInvoker,
1334
+ const jsi::Value &thisValue,
1335
+ const jsi::Value *args,
1336
+ size_t count,
1337
+ UniffiForeignFutureCompleteI32 func) {
1338
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1339
+ // then call the rs_callback with those arguments.
1340
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultI32>::fromJs(rt, callInvoker, args[1])
1341
+ );
1342
+
1343
+
1344
+ return jsi::Value::undefined();
1345
+ }
1346
+ };
1347
+ } // namespace uniffi::mermaid_wrapper
1348
+ namespace uniffi::mermaid_wrapper {
1349
+ using namespace facebook;
1350
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1351
+
1352
+ template <> struct Bridging<UniffiForeignFutureResultU64> {
1353
+ static UniffiForeignFutureResultU64 fromJs(jsi::Runtime &rt,
1354
+ std::shared_ptr<CallInvoker> callInvoker,
1355
+ const jsi::Value &jsValue
1356
+ ) {
1357
+ // Check if the input is an object
1358
+ if (!jsValue.isObject()) {
1359
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultU64");
1360
+ }
1361
+
1362
+ // Get the object from the jsi::Value
1363
+ auto jsObject = jsValue.getObject(rt);
1364
+
1365
+ // Create the vtable struct
1366
+ UniffiForeignFutureResultU64 rsObject;
1367
+
1368
+ // Create the vtable from the js callbacks.
1369
+ rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
1370
+ rt, callInvoker,
1371
+ jsObject.getProperty(rt, "returnValue")
1372
+ );
1373
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1374
+ rt, callInvoker,
1375
+ jsObject.getProperty(rt, "callStatus")
1376
+ );
1377
+
1378
+ return rsObject;
1379
+ }
1380
+ };
1381
+
1382
+ } // namespace uniffi::mermaid_wrapper
1383
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU64,
1384
+ // passed from Rust to JS as part of async callbacks.
1385
+ namespace uniffi::mermaid_wrapper {
1386
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1387
+
1388
+ template <> struct Bridging<UniffiForeignFutureCompleteU64> {
1389
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU64 rsCallback) {
1390
+ return jsi::Function::createFromHostFunction(
1391
+ rt,
1392
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU64"),
1393
+ 2,
1394
+ [rsCallback, callInvoker](
1395
+ jsi::Runtime &rt,
1396
+ const jsi::Value &thisValue,
1397
+ const jsi::Value *arguments,
1398
+ size_t count) -> jsi::Value
1399
+ {
1400
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1401
+ }
1402
+ );
1403
+ }
1404
+
1405
+ static jsi::Value intoRust(
1406
+ jsi::Runtime &rt,
1407
+ std::shared_ptr<CallInvoker> callInvoker,
1408
+ const jsi::Value &thisValue,
1409
+ const jsi::Value *args,
1410
+ size_t count,
1411
+ UniffiForeignFutureCompleteU64 func) {
1412
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1413
+ // then call the rs_callback with those arguments.
1414
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultU64>::fromJs(rt, callInvoker, args[1])
1415
+ );
1416
+
1417
+
1418
+ return jsi::Value::undefined();
1419
+ }
1420
+ };
1421
+ } // namespace uniffi::mermaid_wrapper
1422
+ namespace uniffi::mermaid_wrapper {
1423
+ using namespace facebook;
1424
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1425
+
1426
+ template <> struct Bridging<UniffiForeignFutureResultI64> {
1427
+ static UniffiForeignFutureResultI64 fromJs(jsi::Runtime &rt,
1428
+ std::shared_ptr<CallInvoker> callInvoker,
1429
+ const jsi::Value &jsValue
1430
+ ) {
1431
+ // Check if the input is an object
1432
+ if (!jsValue.isObject()) {
1433
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultI64");
1434
+ }
1435
+
1436
+ // Get the object from the jsi::Value
1437
+ auto jsObject = jsValue.getObject(rt);
1438
+
1439
+ // Create the vtable struct
1440
+ UniffiForeignFutureResultI64 rsObject;
1441
+
1442
+ // Create the vtable from the js callbacks.
1443
+ rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
1444
+ rt, callInvoker,
1445
+ jsObject.getProperty(rt, "returnValue")
1446
+ );
1447
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1448
+ rt, callInvoker,
1449
+ jsObject.getProperty(rt, "callStatus")
1450
+ );
1451
+
1452
+ return rsObject;
1453
+ }
1454
+ };
1455
+
1456
+ } // namespace uniffi::mermaid_wrapper
1457
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI64,
1458
+ // passed from Rust to JS as part of async callbacks.
1459
+ namespace uniffi::mermaid_wrapper {
1460
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1461
+
1462
+ template <> struct Bridging<UniffiForeignFutureCompleteI64> {
1463
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI64 rsCallback) {
1464
+ return jsi::Function::createFromHostFunction(
1465
+ rt,
1466
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI64"),
1467
+ 2,
1468
+ [rsCallback, callInvoker](
1469
+ jsi::Runtime &rt,
1470
+ const jsi::Value &thisValue,
1471
+ const jsi::Value *arguments,
1472
+ size_t count) -> jsi::Value
1473
+ {
1474
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1475
+ }
1476
+ );
1477
+ }
1478
+
1479
+ static jsi::Value intoRust(
1480
+ jsi::Runtime &rt,
1481
+ std::shared_ptr<CallInvoker> callInvoker,
1482
+ const jsi::Value &thisValue,
1483
+ const jsi::Value *args,
1484
+ size_t count,
1485
+ UniffiForeignFutureCompleteI64 func) {
1486
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1487
+ // then call the rs_callback with those arguments.
1488
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultI64>::fromJs(rt, callInvoker, args[1])
1489
+ );
1490
+
1491
+
1492
+ return jsi::Value::undefined();
1493
+ }
1494
+ };
1495
+ } // namespace uniffi::mermaid_wrapper
1496
+ namespace uniffi::mermaid_wrapper {
1497
+ using namespace facebook;
1498
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1499
+
1500
+ template <> struct Bridging<UniffiForeignFutureResultF32> {
1501
+ static UniffiForeignFutureResultF32 fromJs(jsi::Runtime &rt,
1502
+ std::shared_ptr<CallInvoker> callInvoker,
1503
+ const jsi::Value &jsValue
1504
+ ) {
1505
+ // Check if the input is an object
1506
+ if (!jsValue.isObject()) {
1507
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultF32");
1508
+ }
1509
+
1510
+ // Get the object from the jsi::Value
1511
+ auto jsObject = jsValue.getObject(rt);
1512
+
1513
+ // Create the vtable struct
1514
+ UniffiForeignFutureResultF32 rsObject;
1515
+
1516
+ // Create the vtable from the js callbacks.
1517
+ rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
1518
+ rt, callInvoker,
1519
+ jsObject.getProperty(rt, "returnValue")
1520
+ );
1521
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1522
+ rt, callInvoker,
1523
+ jsObject.getProperty(rt, "callStatus")
1524
+ );
1525
+
1526
+ return rsObject;
1527
+ }
1528
+ };
1529
+
1530
+ } // namespace uniffi::mermaid_wrapper
1531
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteF32,
1532
+ // passed from Rust to JS as part of async callbacks.
1533
+ namespace uniffi::mermaid_wrapper {
1534
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1535
+
1536
+ template <> struct Bridging<UniffiForeignFutureCompleteF32> {
1537
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteF32 rsCallback) {
1538
+ return jsi::Function::createFromHostFunction(
1539
+ rt,
1540
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF32"),
1541
+ 2,
1542
+ [rsCallback, callInvoker](
1543
+ jsi::Runtime &rt,
1544
+ const jsi::Value &thisValue,
1545
+ const jsi::Value *arguments,
1546
+ size_t count) -> jsi::Value
1547
+ {
1548
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1549
+ }
1550
+ );
1551
+ }
1552
+
1553
+ static jsi::Value intoRust(
1554
+ jsi::Runtime &rt,
1555
+ std::shared_ptr<CallInvoker> callInvoker,
1556
+ const jsi::Value &thisValue,
1557
+ const jsi::Value *args,
1558
+ size_t count,
1559
+ UniffiForeignFutureCompleteF32 func) {
1560
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1561
+ // then call the rs_callback with those arguments.
1562
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultF32>::fromJs(rt, callInvoker, args[1])
1563
+ );
1564
+
1565
+
1566
+ return jsi::Value::undefined();
1567
+ }
1568
+ };
1569
+ } // namespace uniffi::mermaid_wrapper
1570
+ namespace uniffi::mermaid_wrapper {
1571
+ using namespace facebook;
1572
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1573
+
1574
+ template <> struct Bridging<UniffiForeignFutureResultF64> {
1575
+ static UniffiForeignFutureResultF64 fromJs(jsi::Runtime &rt,
1576
+ std::shared_ptr<CallInvoker> callInvoker,
1577
+ const jsi::Value &jsValue
1578
+ ) {
1579
+ // Check if the input is an object
1580
+ if (!jsValue.isObject()) {
1581
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultF64");
1582
+ }
1583
+
1584
+ // Get the object from the jsi::Value
1585
+ auto jsObject = jsValue.getObject(rt);
1586
+
1587
+ // Create the vtable struct
1588
+ UniffiForeignFutureResultF64 rsObject;
1589
+
1590
+ // Create the vtable from the js callbacks.
1591
+ rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
1592
+ rt, callInvoker,
1593
+ jsObject.getProperty(rt, "returnValue")
1594
+ );
1595
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1596
+ rt, callInvoker,
1597
+ jsObject.getProperty(rt, "callStatus")
1598
+ );
1599
+
1600
+ return rsObject;
1601
+ }
1602
+ };
1603
+
1604
+ } // namespace uniffi::mermaid_wrapper
1605
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteF64,
1606
+ // passed from Rust to JS as part of async callbacks.
1607
+ namespace uniffi::mermaid_wrapper {
1608
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1609
+
1610
+ template <> struct Bridging<UniffiForeignFutureCompleteF64> {
1611
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteF64 rsCallback) {
1612
+ return jsi::Function::createFromHostFunction(
1613
+ rt,
1614
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF64"),
1615
+ 2,
1616
+ [rsCallback, callInvoker](
1617
+ jsi::Runtime &rt,
1618
+ const jsi::Value &thisValue,
1619
+ const jsi::Value *arguments,
1620
+ size_t count) -> jsi::Value
1621
+ {
1622
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1623
+ }
1624
+ );
1625
+ }
1626
+
1627
+ static jsi::Value intoRust(
1628
+ jsi::Runtime &rt,
1629
+ std::shared_ptr<CallInvoker> callInvoker,
1630
+ const jsi::Value &thisValue,
1631
+ const jsi::Value *args,
1632
+ size_t count,
1633
+ UniffiForeignFutureCompleteF64 func) {
1634
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1635
+ // then call the rs_callback with those arguments.
1636
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultF64>::fromJs(rt, callInvoker, args[1])
1637
+ );
1638
+
1639
+
1640
+ return jsi::Value::undefined();
1641
+ }
1642
+ };
1643
+ } // namespace uniffi::mermaid_wrapper
1644
+ namespace uniffi::mermaid_wrapper {
1645
+ using namespace facebook;
1646
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1647
+
1648
+ template <> struct Bridging<UniffiForeignFutureResultRustBuffer> {
1649
+ static UniffiForeignFutureResultRustBuffer fromJs(jsi::Runtime &rt,
1650
+ std::shared_ptr<CallInvoker> callInvoker,
1651
+ const jsi::Value &jsValue
1652
+ ) {
1653
+ // Check if the input is an object
1654
+ if (!jsValue.isObject()) {
1655
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultRustBuffer");
1656
+ }
1657
+
1658
+ // Get the object from the jsi::Value
1659
+ auto jsObject = jsValue.getObject(rt);
1660
+
1661
+ // Create the vtable struct
1662
+ UniffiForeignFutureResultRustBuffer rsObject;
1663
+
1664
+ // Create the vtable from the js callbacks.
1665
+ rsObject.return_value = uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(
1666
+ rt, callInvoker,
1667
+ jsObject.getProperty(rt, "returnValue")
1668
+ );
1669
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1670
+ rt, callInvoker,
1671
+ jsObject.getProperty(rt, "callStatus")
1672
+ );
1673
+
1674
+ return rsObject;
1675
+ }
1676
+ };
1677
+
1678
+ } // namespace uniffi::mermaid_wrapper
1679
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteRustBuffer,
1680
+ // passed from Rust to JS as part of async callbacks.
1681
+ namespace uniffi::mermaid_wrapper {
1682
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1683
+
1684
+ template <> struct Bridging<UniffiForeignFutureCompleteRustBuffer> {
1685
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteRustBuffer rsCallback) {
1686
+ return jsi::Function::createFromHostFunction(
1687
+ rt,
1688
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
1689
+ 2,
1690
+ [rsCallback, callInvoker](
1691
+ jsi::Runtime &rt,
1692
+ const jsi::Value &thisValue,
1693
+ const jsi::Value *arguments,
1694
+ size_t count) -> jsi::Value
1695
+ {
1696
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1697
+ }
1698
+ );
1699
+ }
1700
+
1701
+ static jsi::Value intoRust(
1702
+ jsi::Runtime &rt,
1703
+ std::shared_ptr<CallInvoker> callInvoker,
1704
+ const jsi::Value &thisValue,
1705
+ const jsi::Value *args,
1706
+ size_t count,
1707
+ UniffiForeignFutureCompleteRustBuffer func) {
1708
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1709
+ // then call the rs_callback with those arguments.
1710
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultRustBuffer>::fromJs(rt, callInvoker, args[1])
1711
+ );
1712
+
1713
+
1714
+ return jsi::Value::undefined();
1715
+ }
1716
+ };
1717
+ } // namespace uniffi::mermaid_wrapper
1718
+ namespace uniffi::mermaid_wrapper {
1719
+ using namespace facebook;
1720
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1721
+
1722
+ template <> struct Bridging<UniffiForeignFutureResultVoid> {
1723
+ static UniffiForeignFutureResultVoid fromJs(jsi::Runtime &rt,
1724
+ std::shared_ptr<CallInvoker> callInvoker,
1725
+ const jsi::Value &jsValue
1726
+ ) {
1727
+ // Check if the input is an object
1728
+ if (!jsValue.isObject()) {
1729
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureResultVoid");
1730
+ }
1731
+
1732
+ // Get the object from the jsi::Value
1733
+ auto jsObject = jsValue.getObject(rt);
1734
+
1735
+ // Create the vtable struct
1736
+ UniffiForeignFutureResultVoid rsObject;
1737
+
1738
+ // Create the vtable from the js callbacks.
1739
+ rsObject.call_status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::fromJs(
1740
+ rt, callInvoker,
1741
+ jsObject.getProperty(rt, "callStatus")
1742
+ );
1743
+
1744
+ return rsObject;
1745
+ }
1746
+ };
1747
+
1748
+ } // namespace uniffi::mermaid_wrapper
1749
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteVoid,
1750
+ // passed from Rust to JS as part of async callbacks.
1751
+ namespace uniffi::mermaid_wrapper {
1752
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1753
+
1754
+ template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
1755
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteVoid rsCallback) {
1756
+ return jsi::Function::createFromHostFunction(
1757
+ rt,
1758
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteVoid"),
1759
+ 2,
1760
+ [rsCallback, callInvoker](
1761
+ jsi::Runtime &rt,
1762
+ const jsi::Value &thisValue,
1763
+ const jsi::Value *arguments,
1764
+ size_t count) -> jsi::Value
1765
+ {
1766
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1767
+ }
1768
+ );
1769
+ }
1770
+
1771
+ static jsi::Value intoRust(
1772
+ jsi::Runtime &rt,
1773
+ std::shared_ptr<CallInvoker> callInvoker,
1774
+ const jsi::Value &thisValue,
1775
+ const jsi::Value *args,
1776
+ size_t count,
1777
+ UniffiForeignFutureCompleteVoid func) {
1778
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1779
+ // then call the rs_callback with those arguments.
1780
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::mermaid_wrapper::Bridging<UniffiForeignFutureResultVoid>::fromJs(rt, callInvoker, args[1])
1781
+ );
1782
+
1783
+
1784
+ return jsi::Value::undefined();
1785
+ }
1786
+ };
1787
+ } // namespace uniffi::mermaid_wrapper
1788
+
1789
+
1790
+ namespace uniffi::mermaid_wrapper {
1791
+ using namespace facebook;
1792
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1793
+
1794
+ template <> struct Bridging<UniffiRustFutureContinuationCallback> {
1795
+ static UniffiRustFutureContinuationCallback fromJs(
1796
+ jsi::Runtime &rt,
1797
+ std::shared_ptr<CallInvoker> callInvoker,
1798
+ const jsi::Value &value
1799
+ ) {
1800
+ try {
1801
+ return uniffi::mermaid_wrapper::cb::rustfuturecontinuationcallback::makeCallbackFunction(
1802
+ rt,
1803
+ callInvoker,
1804
+ value
1805
+ );
1806
+ } catch (const std::logic_error &e) {
1807
+ throw jsi::JSError(rt, e.what());
1808
+ }
1809
+ }
1810
+ };
1811
+
1812
+ } // namespace uniffi::mermaid_wrapper
1813
+
1814
+ NativeMermaidWrapper::NativeMermaidWrapper(
1815
+ jsi::Runtime &rt,
1816
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker
1817
+ ) : callInvoker(invoker), props() {
1818
+ // Map from Javascript names to the cpp names
1819
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"] = jsi::Function::createFromHostFunction(
1820
+ rt,
1821
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"),
1822
+ 1,
1823
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1824
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(rt, thisVal, args, count);
1825
+ }
1826
+ );
1827
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"] = jsi::Function::createFromHostFunction(
1828
+ rt,
1829
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"),
1830
+ 1,
1831
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1832
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(rt, thisVal, args, count);
1833
+ }
1834
+ );
1835
+ props["ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"] = jsi::Function::createFromHostFunction(
1836
+ rt,
1837
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"),
1838
+ 1,
1839
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1840
+ return this->cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(rt, thisVal, args, count);
1841
+ }
1842
+ );
1843
+ props["ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout"] = jsi::Function::createFromHostFunction(
1844
+ rt,
1845
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout"),
1846
+ 1,
1847
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1848
+ return this->cpp_uniffi_mermaid_wrapper_fn_clone_ariellayout(rt, thisVal, args, count);
1849
+ }
1850
+ );
1851
+ props["ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout"] = jsi::Function::createFromHostFunction(
1852
+ rt,
1853
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout"),
1854
+ 1,
1855
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1856
+ return this->cpp_uniffi_mermaid_wrapper_fn_free_ariellayout(rt, thisVal, args, count);
1857
+ }
1858
+ );
1859
+ props["ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram"] = jsi::Function::createFromHostFunction(
1860
+ rt,
1861
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram"),
1862
+ 1,
1863
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1864
+ return this->cpp_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(rt, thisVal, args, count);
1865
+ }
1866
+ );
1867
+ props["ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram"] = jsi::Function::createFromHostFunction(
1868
+ rt,
1869
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram"),
1870
+ 1,
1871
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1872
+ return this->cpp_uniffi_mermaid_wrapper_fn_free_arielparseddiagram(rt, thisVal, args, count);
1873
+ }
1874
+ );
1875
+ props["ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme"] = jsi::Function::createFromHostFunction(
1876
+ rt,
1877
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme"),
1878
+ 1,
1879
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1880
+ return this->cpp_uniffi_mermaid_wrapper_fn_clone_arieltheme(rt, thisVal, args, count);
1881
+ }
1882
+ );
1883
+ props["ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme"] = jsi::Function::createFromHostFunction(
1884
+ rt,
1885
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme"),
1886
+ 1,
1887
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1888
+ return this->cpp_uniffi_mermaid_wrapper_fn_free_arieltheme(rt, thisVal, args, count);
1889
+ }
1890
+ );
1891
+ props["ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default"] = jsi::Function::createFromHostFunction(
1892
+ rt,
1893
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default"),
1894
+ 0,
1895
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1896
+ return this->cpp_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(rt, thisVal, args, count);
1897
+ }
1898
+ );
1899
+ props["ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern"] = jsi::Function::createFromHostFunction(
1900
+ rt,
1901
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern"),
1902
+ 0,
1903
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1904
+ return this->cpp_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(rt, thisVal, args, count);
1905
+ }
1906
+ );
1907
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout"] = jsi::Function::createFromHostFunction(
1908
+ rt,
1909
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout"),
1910
+ 3,
1911
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1912
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(rt, thisVal, args, count);
1913
+ }
1914
+ );
1915
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram"] = jsi::Function::createFromHostFunction(
1916
+ rt,
1917
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram"),
1918
+ 1,
1919
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1920
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_parse_diagram(rt, thisVal, args, count);
1921
+ }
1922
+ );
1923
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid"] = jsi::Function::createFromHostFunction(
1924
+ rt,
1925
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid"),
1926
+ 1,
1927
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1928
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_render_mermaid(rt, thisVal, args, count);
1929
+ }
1930
+ );
1931
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options"] = jsi::Function::createFromHostFunction(
1932
+ rt,
1933
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options"),
1934
+ 3,
1935
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1936
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(rt, thisVal, args, count);
1937
+ }
1938
+ );
1939
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing"] = jsi::Function::createFromHostFunction(
1940
+ rt,
1941
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing"),
1942
+ 3,
1943
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1944
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(rt, thisVal, args, count);
1945
+ }
1946
+ );
1947
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout"] = jsi::Function::createFromHostFunction(
1948
+ rt,
1949
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout"),
1950
+ 3,
1951
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1952
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(rt, thisVal, args, count);
1953
+ }
1954
+ );
1955
+ props["ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs"] = jsi::Function::createFromHostFunction(
1956
+ rt,
1957
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs"),
1958
+ 1,
1959
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1960
+ return this->cpp_uniffi_mermaid_wrapper_fn_func_set_timing_logs(rt, thisVal, args, count);
1961
+ }
1962
+ );
1963
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout"] = jsi::Function::createFromHostFunction(
1964
+ rt,
1965
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout"),
1966
+ 0,
1967
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1968
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout(rt, thisVal, args, count);
1969
+ }
1970
+ );
1971
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram"] = jsi::Function::createFromHostFunction(
1972
+ rt,
1973
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram"),
1974
+ 0,
1975
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1976
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_parse_diagram(rt, thisVal, args, count);
1977
+ }
1978
+ );
1979
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid"] = jsi::Function::createFromHostFunction(
1980
+ rt,
1981
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid"),
1982
+ 0,
1983
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1984
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_render_mermaid(rt, thisVal, args, count);
1985
+ }
1986
+ );
1987
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options"] = jsi::Function::createFromHostFunction(
1988
+ rt,
1989
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options"),
1990
+ 0,
1991
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
1992
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options(rt, thisVal, args, count);
1993
+ }
1994
+ );
1995
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing"] = jsi::Function::createFromHostFunction(
1996
+ rt,
1997
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing"),
1998
+ 0,
1999
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2000
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing(rt, thisVal, args, count);
2001
+ }
2002
+ );
2003
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout"] = jsi::Function::createFromHostFunction(
2004
+ rt,
2005
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout"),
2006
+ 0,
2007
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2008
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout(rt, thisVal, args, count);
2009
+ }
2010
+ );
2011
+ props["ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs"] = jsi::Function::createFromHostFunction(
2012
+ rt,
2013
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs"),
2014
+ 0,
2015
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2016
+ return this->cpp_uniffi_mermaid_wrapper_checksum_func_set_timing_logs(rt, thisVal, args, count);
2017
+ }
2018
+ );
2019
+ props["ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default"] = jsi::Function::createFromHostFunction(
2020
+ rt,
2021
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default"),
2022
+ 0,
2023
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2024
+ return this->cpp_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default(rt, thisVal, args, count);
2025
+ }
2026
+ );
2027
+ props["ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern"] = jsi::Function::createFromHostFunction(
2028
+ rt,
2029
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern"),
2030
+ 0,
2031
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2032
+ return this->cpp_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern(rt, thisVal, args, count);
2033
+ }
2034
+ );
2035
+ props["ubrn_ffi_mermaid_wrapper_uniffi_contract_version"] = jsi::Function::createFromHostFunction(
2036
+ rt,
2037
+ jsi::PropNameID::forAscii(rt, "ubrn_ffi_mermaid_wrapper_uniffi_contract_version"),
2038
+ 0,
2039
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2040
+ return this->cpp_ffi_mermaid_wrapper_uniffi_contract_version(rt, thisVal, args, count);
2041
+ }
2042
+ );
2043
+ props["ubrn_uniffi_internal_fn_method_ariellayout_ffi__bless_pointer"] = jsi::Function::createFromHostFunction(
2044
+ rt,
2045
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_ariellayout_ffi__bless_pointer"),
2046
+ 1,
2047
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2048
+ return this->cpp_uniffi_internal_fn_method_ariellayout_ffi__bless_pointer(rt, thisVal, args, count);
2049
+ }
2050
+ );
2051
+ props["ubrn_uniffi_internal_fn_method_arielparseddiagram_ffi__bless_pointer"] = jsi::Function::createFromHostFunction(
2052
+ rt,
2053
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_arielparseddiagram_ffi__bless_pointer"),
2054
+ 1,
2055
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2056
+ return this->cpp_uniffi_internal_fn_method_arielparseddiagram_ffi__bless_pointer(rt, thisVal, args, count);
2057
+ }
2058
+ );
2059
+ props["ubrn_uniffi_internal_fn_method_arieltheme_ffi__bless_pointer"] = jsi::Function::createFromHostFunction(
2060
+ rt,
2061
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_arieltheme_ffi__bless_pointer"),
2062
+ 1,
2063
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2064
+ return this->cpp_uniffi_internal_fn_method_arieltheme_ffi__bless_pointer(rt, thisVal, args, count);
2065
+ }
2066
+ );
2067
+ }
2068
+
2069
+ void NativeMermaidWrapper::registerModule(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker) {
2070
+ auto invoker = std::make_shared<uniffi_runtime::UniffiCallInvoker>(callInvoker);
2071
+ auto tm = std::make_shared<NativeMermaidWrapper>(rt, invoker);
2072
+ auto obj = rt.global().createFromHostObject(rt, tm);
2073
+ rt.global().setProperty(rt, "NativeMermaidWrapper", obj);
2074
+ }
2075
+
2076
+ void NativeMermaidWrapper::unregisterModule(jsi::Runtime &rt) {
2077
+ uniffi::mermaid_wrapper::registry::clearRegistry();
2078
+ }
2079
+
2080
+ jsi::Value NativeMermaidWrapper::get(jsi::Runtime& rt, const jsi::PropNameID& name) {
2081
+ try {
2082
+ return jsi::Value(rt, props.at(name.utf8(rt)));
2083
+ }
2084
+ catch (std::out_of_range &e) {
2085
+ return jsi::Value::undefined();
2086
+ }
2087
+ }
2088
+
2089
+ std::vector<jsi::PropNameID> NativeMermaidWrapper::getPropertyNames(jsi::Runtime& rt) {
2090
+ std::vector<jsi::PropNameID> rval;
2091
+ for (auto& [key, value] : props) {
2092
+ rval.push_back(jsi::PropNameID::forUtf8(rt, key));
2093
+ }
2094
+ return rval;
2095
+ }
2096
+
2097
+ void NativeMermaidWrapper::set(jsi::Runtime& rt, const jsi::PropNameID& name, const jsi::Value& value) {
2098
+ props.insert_or_assign(name.utf8(rt), &value);
2099
+ }
2100
+
2101
+ NativeMermaidWrapper::~NativeMermaidWrapper() {
2102
+ // Cleanup for callback function RustFutureContinuationCallback
2103
+ uniffi::mermaid_wrapper::cb::rustfuturecontinuationcallback::cleanup();
2104
+ // Cleanup for callback function ForeignFutureDroppedCallback
2105
+ uniffi::mermaid_wrapper::cb::foreignfuturedroppedcallback::cleanup();
2106
+ // Cleanup for "free" callback function CallbackInterfaceFree
2107
+
2108
+ }
2109
+
2110
+ // Utility functions for serialization/deserialization of strings.
2111
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2112
+ return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
2113
+ }
2114
+
2115
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2116
+ return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
2117
+ }
2118
+
2119
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2120
+ return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
2121
+ }jsi::Value NativeMermaidWrapper::cpp_uniffi_internal_fn_method_ariellayout_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2122
+ auto pointer = uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
2123
+ auto static destructor = [](uint64_t p) {
2124
+ RustCallStatus status = {0};
2125
+ uniffi_mermaid_wrapper_fn_free_ariellayout(p, &status);
2126
+ };
2127
+ auto ptrObj = std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
2128
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
2129
+ return jsi::Value(rt, obj);
2130
+ }jsi::Value NativeMermaidWrapper::cpp_uniffi_internal_fn_method_arielparseddiagram_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2131
+ auto pointer = uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
2132
+ auto static destructor = [](uint64_t p) {
2133
+ RustCallStatus status = {0};
2134
+ uniffi_mermaid_wrapper_fn_free_arielparseddiagram(p, &status);
2135
+ };
2136
+ auto ptrObj = std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
2137
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
2138
+ return jsi::Value(rt, obj);
2139
+ }jsi::Value NativeMermaidWrapper::cpp_uniffi_internal_fn_method_arieltheme_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2140
+ auto pointer = uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
2141
+ auto static destructor = [](uint64_t p) {
2142
+ RustCallStatus status = {0};
2143
+ uniffi_mermaid_wrapper_fn_free_arieltheme(p, &status);
2144
+ };
2145
+ auto ptrObj = std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
2146
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
2147
+ return jsi::Value(rt, obj);
2148
+ }
2149
+
2150
+ // Methods calling directly into the uniffi generated C API of the Rust crate.
2151
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_clone_ariellayout(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2152
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2153
+ auto value = uniffi_mermaid_wrapper_fn_clone_ariellayout(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]),
2154
+ &status
2155
+ );
2156
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2157
+
2158
+
2159
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2160
+ }
2161
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_free_ariellayout(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2162
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2163
+ uniffi_mermaid_wrapper_fn_free_ariellayout(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]),
2164
+ &status
2165
+ );
2166
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2167
+
2168
+
2169
+ return jsi::Value::undefined();
2170
+ }
2171
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2172
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2173
+ auto value = uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]),
2174
+ &status
2175
+ );
2176
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2177
+
2178
+
2179
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2180
+ }
2181
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_free_arielparseddiagram(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2182
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2183
+ uniffi_mermaid_wrapper_fn_free_arielparseddiagram(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]),
2184
+ &status
2185
+ );
2186
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2187
+
2188
+
2189
+ return jsi::Value::undefined();
2190
+ }
2191
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_clone_arieltheme(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2192
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2193
+ auto value = uniffi_mermaid_wrapper_fn_clone_arieltheme(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]),
2194
+ &status
2195
+ );
2196
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2197
+
2198
+
2199
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2200
+ }
2201
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_free_arieltheme(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2202
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2203
+ uniffi_mermaid_wrapper_fn_free_arieltheme(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]),
2204
+ &status
2205
+ );
2206
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2207
+
2208
+
2209
+ return jsi::Value::undefined();
2210
+ }
2211
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2212
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2213
+ auto value = uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(&status
2214
+ );
2215
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2216
+
2217
+
2218
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2219
+ }
2220
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2221
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2222
+ auto value = uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(&status
2223
+ );
2224
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2225
+
2226
+
2227
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2228
+ }
2229
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2230
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2231
+ auto value = uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[1]), uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]),
2232
+ &status
2233
+ );
2234
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2235
+
2236
+
2237
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2238
+ }
2239
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_parse_diagram(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2240
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2241
+ auto value = uniffi_mermaid_wrapper_fn_func_parse_diagram(uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
2242
+ &status
2243
+ );
2244
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2245
+
2246
+
2247
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
2248
+ }
2249
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_render_mermaid(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2250
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2251
+ auto value = uniffi_mermaid_wrapper_fn_func_render_mermaid(uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
2252
+ &status
2253
+ );
2254
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2255
+
2256
+
2257
+ return uniffi::mermaid_wrapper::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2258
+ }
2259
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2260
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2261
+ auto value = uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[1]), uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]),
2262
+ &status
2263
+ );
2264
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2265
+
2266
+
2267
+ return uniffi::mermaid_wrapper::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2268
+ }
2269
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2270
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2271
+ auto value = uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[1]), uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]),
2272
+ &status
2273
+ );
2274
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2275
+
2276
+
2277
+ return uniffi::mermaid_wrapper::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2278
+ }
2279
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2280
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2281
+ auto value = uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[1]), uniffi::mermaid_wrapper::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]),
2282
+ &status
2283
+ );
2284
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2285
+
2286
+
2287
+ return uniffi::mermaid_wrapper::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2288
+ }
2289
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_fn_func_set_timing_logs(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2290
+ RustCallStatus status = uniffi::mermaid_wrapper::Bridging<RustCallStatus>::rustSuccess(rt);
2291
+ uniffi_mermaid_wrapper_fn_func_set_timing_logs(uniffi_jsi::Bridging<int8_t>::fromJs(rt, callInvoker, args[0]),
2292
+ &status
2293
+ );
2294
+ uniffi::mermaid_wrapper::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2295
+
2296
+
2297
+ return jsi::Value::undefined();
2298
+ }
2299
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2300
+ auto value = uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout(
2301
+ );
2302
+
2303
+
2304
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2305
+ }
2306
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_parse_diagram(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2307
+ auto value = uniffi_mermaid_wrapper_checksum_func_parse_diagram(
2308
+ );
2309
+
2310
+
2311
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2312
+ }
2313
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_render_mermaid(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2314
+ auto value = uniffi_mermaid_wrapper_checksum_func_render_mermaid(
2315
+ );
2316
+
2317
+
2318
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2319
+ }
2320
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2321
+ auto value = uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options(
2322
+ );
2323
+
2324
+
2325
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2326
+ }
2327
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2328
+ auto value = uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing(
2329
+ );
2330
+
2331
+
2332
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2333
+ }
2334
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2335
+ auto value = uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout(
2336
+ );
2337
+
2338
+
2339
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2340
+ }
2341
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_func_set_timing_logs(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2342
+ auto value = uniffi_mermaid_wrapper_checksum_func_set_timing_logs(
2343
+ );
2344
+
2345
+
2346
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2347
+ }
2348
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2349
+ auto value = uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default(
2350
+ );
2351
+
2352
+
2353
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2354
+ }
2355
+ jsi::Value NativeMermaidWrapper::cpp_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2356
+ auto value = uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern(
2357
+ );
2358
+
2359
+
2360
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2361
+ }
2362
+ jsi::Value NativeMermaidWrapper::cpp_ffi_mermaid_wrapper_uniffi_contract_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2363
+ auto value = ffi_mermaid_wrapper_uniffi_contract_version(
2364
+ );
2365
+
2366
+
2367
+ return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
2368
+ }