@rusaint/react-native 0.10.0-dev.0

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