@succinctlabs/react-native-zcam1 0.2.5 → 0.2.7
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.
- package/README.md +144 -10
- package/Zcam1Sdk.podspec +1 -4
- package/cpp/generated/zcam1_c2pa_utils.cpp +2910 -3365
- package/cpp/generated/zcam1_c2pa_utils.hpp +130 -352
- package/cpp/generated/zcam1_certs_utils.cpp +1266 -1064
- package/cpp/generated/zcam1_certs_utils.hpp +37 -57
- package/cpp/generated/zcam1_verify_utils.cpp +1307 -1120
- package/cpp/generated/zcam1_verify_utils.hpp +39 -64
- package/cpp/proving/generated/zcam1_proving_utils.cpp +2619 -2917
- package/cpp/proving/generated/zcam1_proving_utils.hpp +102 -260
- package/ios/Zcam1Camera.swift +140 -53
- package/ios/Zcam1CameraFilmStyle.swift +106 -0
- package/lib/module/camera.js +2 -11
- package/lib/module/camera.js.map +1 -1
- package/lib/module/capture.js +2 -2
- package/lib/module/capture.js.map +1 -1
- package/lib/module/common.js +1 -1
- package/lib/module/common.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/picker.js +2 -1
- package/lib/module/picker.js.map +1 -1
- package/lib/module/proving/prove.js +4 -4
- package/lib/module/proving/prove.js.map +1 -1
- package/lib/module/utils.js +7 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/src/camera.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/picker.d.ts.map +1 -1
- package/lib/typescript/src/proving/prove.d.ts +1 -1
- package/lib/typescript/src/proving/prove.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +4 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/camera.tsx +2 -13
- package/src/capture.tsx +2 -2
- package/src/common.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/picker.tsx +2 -1
- package/src/proving/prove.tsx +5 -5
- package/src/utils.ts +7 -0
|
@@ -1,240 +1,362 @@
|
|
|
1
|
-
// This file was autogenerated by some hot garbage in the
|
|
2
|
-
//
|
|
3
|
-
// it!
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
4
3
|
#include "zcam1_certs_utils.hpp"
|
|
5
4
|
|
|
6
5
|
#include "UniffiJsiTypes.h"
|
|
7
|
-
#include <iostream>
|
|
8
|
-
#include <map>
|
|
9
6
|
#include <stdexcept>
|
|
10
|
-
#include <
|
|
7
|
+
#include <map>
|
|
11
8
|
#include <utility>
|
|
9
|
+
#include <iostream>
|
|
10
|
+
#include <thread>
|
|
12
11
|
|
|
13
12
|
namespace react = facebook::react;
|
|
14
13
|
namespace jsi = facebook::jsi;
|
|
15
14
|
|
|
16
15
|
// Calling into Rust.
|
|
17
16
|
extern "C" {
|
|
18
|
-
typedef void
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
typedef
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
uint64_t callback_data,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
uint64_t callback_data,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
typedef void
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
void
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
void
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
void
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
void
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
void
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
void
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
void
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
17
|
+
typedef void
|
|
18
|
+
(*UniffiRustFutureContinuationCallback)(
|
|
19
|
+
uint64_t data,
|
|
20
|
+
int8_t poll_result
|
|
21
|
+
);
|
|
22
|
+
typedef void
|
|
23
|
+
(*UniffiForeignFutureFree)(
|
|
24
|
+
uint64_t handle
|
|
25
|
+
);
|
|
26
|
+
typedef void
|
|
27
|
+
(*UniffiCallbackInterfaceFree)(
|
|
28
|
+
uint64_t handle
|
|
29
|
+
);typedef struct UniffiForeignFuture {
|
|
30
|
+
uint64_t handle;
|
|
31
|
+
UniffiForeignFutureFree free;
|
|
32
|
+
} UniffiForeignFuture;typedef struct UniffiForeignFutureStructU8 {
|
|
33
|
+
uint8_t return_value;
|
|
34
|
+
RustCallStatus call_status;
|
|
35
|
+
} UniffiForeignFutureStructU8;
|
|
36
|
+
typedef void
|
|
37
|
+
(*UniffiForeignFutureCompleteU8)(
|
|
38
|
+
uint64_t callback_data,
|
|
39
|
+
UniffiForeignFutureStructU8 result
|
|
40
|
+
);typedef struct UniffiForeignFutureStructI8 {
|
|
41
|
+
int8_t return_value;
|
|
42
|
+
RustCallStatus call_status;
|
|
43
|
+
} UniffiForeignFutureStructI8;
|
|
44
|
+
typedef void
|
|
45
|
+
(*UniffiForeignFutureCompleteI8)(
|
|
46
|
+
uint64_t callback_data,
|
|
47
|
+
UniffiForeignFutureStructI8 result
|
|
48
|
+
);typedef struct UniffiForeignFutureStructU16 {
|
|
49
|
+
uint16_t return_value;
|
|
50
|
+
RustCallStatus call_status;
|
|
51
|
+
} UniffiForeignFutureStructU16;
|
|
52
|
+
typedef void
|
|
53
|
+
(*UniffiForeignFutureCompleteU16)(
|
|
54
|
+
uint64_t callback_data,
|
|
55
|
+
UniffiForeignFutureStructU16 result
|
|
56
|
+
);typedef struct UniffiForeignFutureStructI16 {
|
|
57
|
+
int16_t return_value;
|
|
58
|
+
RustCallStatus call_status;
|
|
59
|
+
} UniffiForeignFutureStructI16;
|
|
60
|
+
typedef void
|
|
61
|
+
(*UniffiForeignFutureCompleteI16)(
|
|
62
|
+
uint64_t callback_data,
|
|
63
|
+
UniffiForeignFutureStructI16 result
|
|
64
|
+
);typedef struct UniffiForeignFutureStructU32 {
|
|
65
|
+
uint32_t return_value;
|
|
66
|
+
RustCallStatus call_status;
|
|
67
|
+
} UniffiForeignFutureStructU32;
|
|
68
|
+
typedef void
|
|
69
|
+
(*UniffiForeignFutureCompleteU32)(
|
|
70
|
+
uint64_t callback_data,
|
|
71
|
+
UniffiForeignFutureStructU32 result
|
|
72
|
+
);typedef struct UniffiForeignFutureStructI32 {
|
|
73
|
+
int32_t return_value;
|
|
74
|
+
RustCallStatus call_status;
|
|
75
|
+
} UniffiForeignFutureStructI32;
|
|
76
|
+
typedef void
|
|
77
|
+
(*UniffiForeignFutureCompleteI32)(
|
|
78
|
+
uint64_t callback_data,
|
|
79
|
+
UniffiForeignFutureStructI32 result
|
|
80
|
+
);typedef struct UniffiForeignFutureStructU64 {
|
|
81
|
+
uint64_t return_value;
|
|
82
|
+
RustCallStatus call_status;
|
|
83
|
+
} UniffiForeignFutureStructU64;
|
|
84
|
+
typedef void
|
|
85
|
+
(*UniffiForeignFutureCompleteU64)(
|
|
86
|
+
uint64_t callback_data,
|
|
87
|
+
UniffiForeignFutureStructU64 result
|
|
88
|
+
);typedef struct UniffiForeignFutureStructI64 {
|
|
89
|
+
int64_t return_value;
|
|
90
|
+
RustCallStatus call_status;
|
|
91
|
+
} UniffiForeignFutureStructI64;
|
|
92
|
+
typedef void
|
|
93
|
+
(*UniffiForeignFutureCompleteI64)(
|
|
94
|
+
uint64_t callback_data,
|
|
95
|
+
UniffiForeignFutureStructI64 result
|
|
96
|
+
);typedef struct UniffiForeignFutureStructF32 {
|
|
97
|
+
float return_value;
|
|
98
|
+
RustCallStatus call_status;
|
|
99
|
+
} UniffiForeignFutureStructF32;
|
|
100
|
+
typedef void
|
|
101
|
+
(*UniffiForeignFutureCompleteF32)(
|
|
102
|
+
uint64_t callback_data,
|
|
103
|
+
UniffiForeignFutureStructF32 result
|
|
104
|
+
);typedef struct UniffiForeignFutureStructF64 {
|
|
105
|
+
double return_value;
|
|
106
|
+
RustCallStatus call_status;
|
|
107
|
+
} UniffiForeignFutureStructF64;
|
|
108
|
+
typedef void
|
|
109
|
+
(*UniffiForeignFutureCompleteF64)(
|
|
110
|
+
uint64_t callback_data,
|
|
111
|
+
UniffiForeignFutureStructF64 result
|
|
112
|
+
);typedef struct UniffiForeignFutureStructPointer {
|
|
113
|
+
void * return_value;
|
|
114
|
+
RustCallStatus call_status;
|
|
115
|
+
} UniffiForeignFutureStructPointer;
|
|
116
|
+
typedef void
|
|
117
|
+
(*UniffiForeignFutureCompletePointer)(
|
|
118
|
+
uint64_t callback_data,
|
|
119
|
+
UniffiForeignFutureStructPointer result
|
|
120
|
+
);typedef struct UniffiForeignFutureStructRustBuffer {
|
|
121
|
+
RustBuffer return_value;
|
|
122
|
+
RustCallStatus call_status;
|
|
123
|
+
} UniffiForeignFutureStructRustBuffer;
|
|
124
|
+
typedef void
|
|
125
|
+
(*UniffiForeignFutureCompleteRustBuffer)(
|
|
126
|
+
uint64_t callback_data,
|
|
127
|
+
UniffiForeignFutureStructRustBuffer result
|
|
128
|
+
);typedef struct UniffiForeignFutureStructVoid {
|
|
129
|
+
RustCallStatus call_status;
|
|
130
|
+
} UniffiForeignFutureStructVoid;
|
|
131
|
+
typedef void
|
|
132
|
+
(*UniffiForeignFutureCompleteVoid)(
|
|
133
|
+
uint64_t callback_data,
|
|
134
|
+
UniffiForeignFutureStructVoid result
|
|
135
|
+
);
|
|
136
|
+
RustBuffer uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(
|
|
137
|
+
RustBuffer leaf_jwk,
|
|
138
|
+
RustBuffer cert_chain_params,
|
|
139
|
+
RustCallStatus *uniffi_out_err
|
|
140
|
+
);
|
|
141
|
+
RustBuffer ffi_zcam1_certs_utils_rustbuffer_alloc(
|
|
142
|
+
uint64_t size,
|
|
143
|
+
RustCallStatus *uniffi_out_err
|
|
144
|
+
);
|
|
145
|
+
RustBuffer ffi_zcam1_certs_utils_rustbuffer_from_bytes(
|
|
146
|
+
ForeignBytes bytes,
|
|
147
|
+
RustCallStatus *uniffi_out_err
|
|
148
|
+
);
|
|
149
|
+
void ffi_zcam1_certs_utils_rustbuffer_free(
|
|
150
|
+
RustBuffer buf,
|
|
151
|
+
RustCallStatus *uniffi_out_err
|
|
152
|
+
);
|
|
153
|
+
RustBuffer ffi_zcam1_certs_utils_rustbuffer_reserve(
|
|
154
|
+
RustBuffer buf,
|
|
155
|
+
uint64_t additional,
|
|
156
|
+
RustCallStatus *uniffi_out_err
|
|
157
|
+
);
|
|
158
|
+
void ffi_zcam1_certs_utils_rust_future_poll_u8(
|
|
159
|
+
/*handle*/ uint64_t handle,
|
|
160
|
+
UniffiRustFutureContinuationCallback callback,
|
|
161
|
+
/*handle*/ uint64_t callback_data
|
|
162
|
+
);
|
|
163
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_u8(
|
|
164
|
+
/*handle*/ uint64_t handle
|
|
165
|
+
);
|
|
166
|
+
void ffi_zcam1_certs_utils_rust_future_free_u8(
|
|
167
|
+
/*handle*/ uint64_t handle
|
|
168
|
+
);
|
|
169
|
+
uint8_t ffi_zcam1_certs_utils_rust_future_complete_u8(
|
|
170
|
+
/*handle*/ uint64_t handle,
|
|
171
|
+
RustCallStatus *uniffi_out_err
|
|
172
|
+
);
|
|
173
|
+
void ffi_zcam1_certs_utils_rust_future_poll_i8(
|
|
174
|
+
/*handle*/ uint64_t handle,
|
|
175
|
+
UniffiRustFutureContinuationCallback callback,
|
|
176
|
+
/*handle*/ uint64_t callback_data
|
|
177
|
+
);
|
|
178
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_i8(
|
|
179
|
+
/*handle*/ uint64_t handle
|
|
180
|
+
);
|
|
181
|
+
void ffi_zcam1_certs_utils_rust_future_free_i8(
|
|
182
|
+
/*handle*/ uint64_t handle
|
|
183
|
+
);
|
|
184
|
+
int8_t ffi_zcam1_certs_utils_rust_future_complete_i8(
|
|
185
|
+
/*handle*/ uint64_t handle,
|
|
186
|
+
RustCallStatus *uniffi_out_err
|
|
187
|
+
);
|
|
188
|
+
void ffi_zcam1_certs_utils_rust_future_poll_u16(
|
|
189
|
+
/*handle*/ uint64_t handle,
|
|
190
|
+
UniffiRustFutureContinuationCallback callback,
|
|
191
|
+
/*handle*/ uint64_t callback_data
|
|
192
|
+
);
|
|
193
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_u16(
|
|
194
|
+
/*handle*/ uint64_t handle
|
|
195
|
+
);
|
|
196
|
+
void ffi_zcam1_certs_utils_rust_future_free_u16(
|
|
197
|
+
/*handle*/ uint64_t handle
|
|
198
|
+
);
|
|
199
|
+
uint16_t ffi_zcam1_certs_utils_rust_future_complete_u16(
|
|
200
|
+
/*handle*/ uint64_t handle,
|
|
201
|
+
RustCallStatus *uniffi_out_err
|
|
202
|
+
);
|
|
203
|
+
void ffi_zcam1_certs_utils_rust_future_poll_i16(
|
|
204
|
+
/*handle*/ uint64_t handle,
|
|
205
|
+
UniffiRustFutureContinuationCallback callback,
|
|
206
|
+
/*handle*/ uint64_t callback_data
|
|
207
|
+
);
|
|
208
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_i16(
|
|
209
|
+
/*handle*/ uint64_t handle
|
|
210
|
+
);
|
|
211
|
+
void ffi_zcam1_certs_utils_rust_future_free_i16(
|
|
212
|
+
/*handle*/ uint64_t handle
|
|
213
|
+
);
|
|
214
|
+
int16_t ffi_zcam1_certs_utils_rust_future_complete_i16(
|
|
215
|
+
/*handle*/ uint64_t handle,
|
|
216
|
+
RustCallStatus *uniffi_out_err
|
|
217
|
+
);
|
|
218
|
+
void ffi_zcam1_certs_utils_rust_future_poll_u32(
|
|
219
|
+
/*handle*/ uint64_t handle,
|
|
220
|
+
UniffiRustFutureContinuationCallback callback,
|
|
221
|
+
/*handle*/ uint64_t callback_data
|
|
222
|
+
);
|
|
223
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_u32(
|
|
224
|
+
/*handle*/ uint64_t handle
|
|
225
|
+
);
|
|
226
|
+
void ffi_zcam1_certs_utils_rust_future_free_u32(
|
|
227
|
+
/*handle*/ uint64_t handle
|
|
228
|
+
);
|
|
229
|
+
uint32_t ffi_zcam1_certs_utils_rust_future_complete_u32(
|
|
230
|
+
/*handle*/ uint64_t handle,
|
|
231
|
+
RustCallStatus *uniffi_out_err
|
|
232
|
+
);
|
|
233
|
+
void ffi_zcam1_certs_utils_rust_future_poll_i32(
|
|
234
|
+
/*handle*/ uint64_t handle,
|
|
235
|
+
UniffiRustFutureContinuationCallback callback,
|
|
236
|
+
/*handle*/ uint64_t callback_data
|
|
237
|
+
);
|
|
238
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_i32(
|
|
239
|
+
/*handle*/ uint64_t handle
|
|
240
|
+
);
|
|
241
|
+
void ffi_zcam1_certs_utils_rust_future_free_i32(
|
|
242
|
+
/*handle*/ uint64_t handle
|
|
243
|
+
);
|
|
244
|
+
int32_t ffi_zcam1_certs_utils_rust_future_complete_i32(
|
|
245
|
+
/*handle*/ uint64_t handle,
|
|
246
|
+
RustCallStatus *uniffi_out_err
|
|
247
|
+
);
|
|
248
|
+
void ffi_zcam1_certs_utils_rust_future_poll_u64(
|
|
249
|
+
/*handle*/ uint64_t handle,
|
|
250
|
+
UniffiRustFutureContinuationCallback callback,
|
|
251
|
+
/*handle*/ uint64_t callback_data
|
|
252
|
+
);
|
|
253
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_u64(
|
|
254
|
+
/*handle*/ uint64_t handle
|
|
255
|
+
);
|
|
256
|
+
void ffi_zcam1_certs_utils_rust_future_free_u64(
|
|
257
|
+
/*handle*/ uint64_t handle
|
|
258
|
+
);
|
|
259
|
+
uint64_t ffi_zcam1_certs_utils_rust_future_complete_u64(
|
|
260
|
+
/*handle*/ uint64_t handle,
|
|
261
|
+
RustCallStatus *uniffi_out_err
|
|
262
|
+
);
|
|
263
|
+
void ffi_zcam1_certs_utils_rust_future_poll_i64(
|
|
264
|
+
/*handle*/ uint64_t handle,
|
|
265
|
+
UniffiRustFutureContinuationCallback callback,
|
|
266
|
+
/*handle*/ uint64_t callback_data
|
|
267
|
+
);
|
|
268
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_i64(
|
|
269
|
+
/*handle*/ uint64_t handle
|
|
270
|
+
);
|
|
271
|
+
void ffi_zcam1_certs_utils_rust_future_free_i64(
|
|
272
|
+
/*handle*/ uint64_t handle
|
|
273
|
+
);
|
|
274
|
+
int64_t ffi_zcam1_certs_utils_rust_future_complete_i64(
|
|
275
|
+
/*handle*/ uint64_t handle,
|
|
276
|
+
RustCallStatus *uniffi_out_err
|
|
277
|
+
);
|
|
278
|
+
void ffi_zcam1_certs_utils_rust_future_poll_f32(
|
|
279
|
+
/*handle*/ uint64_t handle,
|
|
280
|
+
UniffiRustFutureContinuationCallback callback,
|
|
281
|
+
/*handle*/ uint64_t callback_data
|
|
282
|
+
);
|
|
283
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_f32(
|
|
284
|
+
/*handle*/ uint64_t handle
|
|
285
|
+
);
|
|
286
|
+
void ffi_zcam1_certs_utils_rust_future_free_f32(
|
|
287
|
+
/*handle*/ uint64_t handle
|
|
288
|
+
);
|
|
289
|
+
float ffi_zcam1_certs_utils_rust_future_complete_f32(
|
|
290
|
+
/*handle*/ uint64_t handle,
|
|
291
|
+
RustCallStatus *uniffi_out_err
|
|
292
|
+
);
|
|
293
|
+
void ffi_zcam1_certs_utils_rust_future_poll_f64(
|
|
294
|
+
/*handle*/ uint64_t handle,
|
|
295
|
+
UniffiRustFutureContinuationCallback callback,
|
|
296
|
+
/*handle*/ uint64_t callback_data
|
|
297
|
+
);
|
|
298
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_f64(
|
|
299
|
+
/*handle*/ uint64_t handle
|
|
300
|
+
);
|
|
301
|
+
void ffi_zcam1_certs_utils_rust_future_free_f64(
|
|
302
|
+
/*handle*/ uint64_t handle
|
|
303
|
+
);
|
|
304
|
+
double ffi_zcam1_certs_utils_rust_future_complete_f64(
|
|
305
|
+
/*handle*/ uint64_t handle,
|
|
306
|
+
RustCallStatus *uniffi_out_err
|
|
307
|
+
);
|
|
308
|
+
void ffi_zcam1_certs_utils_rust_future_poll_pointer(
|
|
309
|
+
/*handle*/ uint64_t handle,
|
|
310
|
+
UniffiRustFutureContinuationCallback callback,
|
|
311
|
+
/*handle*/ uint64_t callback_data
|
|
312
|
+
);
|
|
313
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_pointer(
|
|
314
|
+
/*handle*/ uint64_t handle
|
|
315
|
+
);
|
|
316
|
+
void ffi_zcam1_certs_utils_rust_future_free_pointer(
|
|
317
|
+
/*handle*/ uint64_t handle
|
|
318
|
+
);
|
|
319
|
+
void * ffi_zcam1_certs_utils_rust_future_complete_pointer(
|
|
320
|
+
/*handle*/ uint64_t handle,
|
|
321
|
+
RustCallStatus *uniffi_out_err
|
|
322
|
+
);
|
|
323
|
+
void ffi_zcam1_certs_utils_rust_future_poll_rust_buffer(
|
|
324
|
+
/*handle*/ uint64_t handle,
|
|
325
|
+
UniffiRustFutureContinuationCallback callback,
|
|
326
|
+
/*handle*/ uint64_t callback_data
|
|
327
|
+
);
|
|
328
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_rust_buffer(
|
|
329
|
+
/*handle*/ uint64_t handle
|
|
330
|
+
);
|
|
331
|
+
void ffi_zcam1_certs_utils_rust_future_free_rust_buffer(
|
|
332
|
+
/*handle*/ uint64_t handle
|
|
333
|
+
);
|
|
334
|
+
RustBuffer ffi_zcam1_certs_utils_rust_future_complete_rust_buffer(
|
|
335
|
+
/*handle*/ uint64_t handle,
|
|
336
|
+
RustCallStatus *uniffi_out_err
|
|
337
|
+
);
|
|
338
|
+
void ffi_zcam1_certs_utils_rust_future_poll_void(
|
|
339
|
+
/*handle*/ uint64_t handle,
|
|
340
|
+
UniffiRustFutureContinuationCallback callback,
|
|
341
|
+
/*handle*/ uint64_t callback_data
|
|
342
|
+
);
|
|
343
|
+
void ffi_zcam1_certs_utils_rust_future_cancel_void(
|
|
344
|
+
/*handle*/ uint64_t handle
|
|
345
|
+
);
|
|
346
|
+
void ffi_zcam1_certs_utils_rust_future_free_void(
|
|
347
|
+
/*handle*/ uint64_t handle
|
|
348
|
+
);
|
|
349
|
+
void ffi_zcam1_certs_utils_rust_future_complete_void(
|
|
350
|
+
/*handle*/ uint64_t handle,
|
|
351
|
+
RustCallStatus *uniffi_out_err
|
|
352
|
+
);
|
|
353
|
+
uint16_t uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(
|
|
354
|
+
);
|
|
355
|
+
uint32_t ffi_zcam1_certs_utils_uniffi_contract_version(
|
|
356
|
+
);
|
|
236
357
|
}
|
|
237
358
|
|
|
359
|
+
|
|
238
360
|
namespace uniffi::zcam1_certs_utils {
|
|
239
361
|
template <typename T> struct Bridging;
|
|
240
362
|
|
|
@@ -251,12 +373,12 @@ template <typename T> struct Bridging<ReferenceHolder<T>> {
|
|
|
251
373
|
auto obj = value.asObject(rt);
|
|
252
374
|
if (obj.hasProperty(rt, "pointee")) {
|
|
253
375
|
auto pointee = obj.getProperty(rt, "pointee");
|
|
254
|
-
return uniffi::zcam1_certs_utils::Bridging<T>::fromJs(rt, callInvoker,
|
|
255
|
-
pointee);
|
|
376
|
+
return uniffi::zcam1_certs_utils::Bridging<T>::fromJs(rt, callInvoker, pointee);
|
|
256
377
|
}
|
|
257
|
-
throw jsi::JSError(
|
|
258
|
-
|
|
259
|
-
|
|
378
|
+
throw jsi::JSError(
|
|
379
|
+
rt,
|
|
380
|
+
"Expected ReferenceHolder to have a pointee property. This is likely a bug in uniffi-bindgen-react-native"
|
|
381
|
+
);
|
|
260
382
|
}
|
|
261
383
|
};
|
|
262
384
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -266,26 +388,33 @@ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
|
266
388
|
|
|
267
389
|
template <> struct Bridging<RustBuffer> {
|
|
268
390
|
static RustBuffer rustbuffer_alloc(int32_t size) {
|
|
269
|
-
|
|
270
|
-
|
|
391
|
+
RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
|
|
392
|
+
return ffi_zcam1_certs_utils_rustbuffer_alloc(
|
|
393
|
+
size,
|
|
394
|
+
&status
|
|
395
|
+
);
|
|
271
396
|
}
|
|
272
397
|
|
|
273
398
|
static void rustbuffer_free(RustBuffer buf) {
|
|
274
|
-
RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
|
|
275
|
-
ffi_zcam1_certs_utils_rustbuffer_free(
|
|
399
|
+
RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
|
|
400
|
+
ffi_zcam1_certs_utils_rustbuffer_free(
|
|
401
|
+
buf,
|
|
402
|
+
&status
|
|
403
|
+
);
|
|
276
404
|
}
|
|
277
405
|
|
|
278
406
|
static RustBuffer rustbuffer_from_bytes(ForeignBytes bytes) {
|
|
279
|
-
RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
|
|
280
|
-
return ffi_zcam1_certs_utils_rustbuffer_from_bytes(
|
|
407
|
+
RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
|
|
408
|
+
return ffi_zcam1_certs_utils_rustbuffer_from_bytes(
|
|
409
|
+
bytes,
|
|
410
|
+
&status
|
|
411
|
+
);
|
|
281
412
|
}
|
|
282
413
|
|
|
283
414
|
static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
|
|
284
415
|
const jsi::Value &value) {
|
|
285
416
|
try {
|
|
286
|
-
auto buffer =
|
|
287
|
-
uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt,
|
|
288
|
-
value);
|
|
417
|
+
auto buffer = uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt, value);
|
|
289
418
|
auto bytes = ForeignBytes{
|
|
290
419
|
.len = static_cast<int32_t>(buffer.length(rt)),
|
|
291
420
|
.data = buffer.data(rt),
|
|
@@ -322,9 +451,7 @@ template <> struct Bridging<RustBuffer> {
|
|
|
322
451
|
rustbuffer_free(buf);
|
|
323
452
|
|
|
324
453
|
// Finally, return the ArrayBuffer.
|
|
325
|
-
return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(
|
|
326
|
-
rt, arrayBuffer);
|
|
327
|
-
;
|
|
454
|
+
return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(rt, arrayBuffer);;
|
|
328
455
|
}
|
|
329
456
|
};
|
|
330
457
|
|
|
@@ -349,7 +476,8 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
349
476
|
const jsi::Value &jsStatus) {
|
|
350
477
|
auto statusObject = jsStatus.asObject(rt);
|
|
351
478
|
if (status.error_buf.data != nullptr) {
|
|
352
|
-
auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker,
|
|
479
|
+
auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker,
|
|
480
|
+
status.error_buf);
|
|
353
481
|
statusObject.setProperty(rt, "errorBuf", rbuf);
|
|
354
482
|
}
|
|
355
483
|
if (status.code != UNIFFI_CALL_STATUS_OK) {
|
|
@@ -366,7 +494,8 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
366
494
|
auto statusObject = jsStatus.asObject(rt);
|
|
367
495
|
if (statusObject.hasProperty(rt, "errorBuf")) {
|
|
368
496
|
auto rbuf = statusObject.getProperty(rt, "errorBuf");
|
|
369
|
-
status.error_buf =
|
|
497
|
+
status.error_buf =
|
|
498
|
+
Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
|
|
370
499
|
}
|
|
371
500
|
if (statusObject.hasProperty(rt, "code")) {
|
|
372
501
|
auto code = statusObject.getProperty(rt, "code");
|
|
@@ -380,7 +509,8 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
380
509
|
auto statusObject = jsStatus.asObject(rt);
|
|
381
510
|
if (statusObject.hasProperty(rt, "errorBuf")) {
|
|
382
511
|
auto rbuf = statusObject.getProperty(rt, "errorBuf");
|
|
383
|
-
status->error_buf =
|
|
512
|
+
status->error_buf =
|
|
513
|
+
Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
|
|
384
514
|
}
|
|
385
515
|
if (statusObject.hasProperty(rt, "code")) {
|
|
386
516
|
auto code = statusObject.getProperty(rt, "code");
|
|
@@ -395,309 +525,329 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
395
525
|
// Here, we need to hold on to them, but also be able to clear them at just the
|
|
396
526
|
// right time so we can support hot-reloading.
|
|
397
527
|
namespace uniffi::zcam1_certs_utils::registry {
|
|
398
|
-
template <typename T>
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
//
|
|
406
|
-
//
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
//
|
|
411
|
-
//
|
|
412
|
-
//
|
|
413
|
-
//
|
|
414
|
-
//
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
528
|
+
template <typename T>
|
|
529
|
+
class VTableHolder {
|
|
530
|
+
public:
|
|
531
|
+
T vtable;
|
|
532
|
+
VTableHolder(T v) : vtable(v) {}
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// Mutex to bind the storage and setting of vtable together.
|
|
536
|
+
// We declare it here, but the lock is taken by callers of the putTable
|
|
537
|
+
// method who are also sending a pointer to Rust.
|
|
538
|
+
static std::mutex vtableMutex;
|
|
539
|
+
|
|
540
|
+
// Registry to hold all vtables so they persist even when JS objects are GC'd.
|
|
541
|
+
// The only reason this exists is to prevent a dangling pointer in the
|
|
542
|
+
// Rust machinery: i.e. we don't need to access or write to this registry
|
|
543
|
+
// after startup.
|
|
544
|
+
// Registry to hold all vtables so they persist even when JS objects are GC'd.
|
|
545
|
+
// Maps string identifiers to vtable holders using type erasure
|
|
546
|
+
static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
|
|
547
|
+
|
|
548
|
+
// Add a vtable to the registry with an identifier
|
|
549
|
+
template <typename T>
|
|
550
|
+
static T* putTable(std::string_view identifier, T vtable) {
|
|
551
|
+
auto holder = std::make_shared<VTableHolder<T>>(vtable);
|
|
552
|
+
// Store the raw pointer to the vtable before type erasure
|
|
553
|
+
T* rawPtr = &(holder->vtable);
|
|
554
|
+
// Store the holder using type erasure with the string identifier
|
|
555
|
+
vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
|
|
556
|
+
return rawPtr;
|
|
557
|
+
}
|
|
427
558
|
|
|
428
|
-
// Clear the registry.
|
|
429
|
-
//
|
|
430
|
-
// Conceptually, this is called after teardown of the module (i.e. after
|
|
431
|
-
// teardown of the jsi::Runtime). However, because Rust is dropping callbacks
|
|
432
|
-
// because the Runtime is being torn down, we must keep the registry intact
|
|
433
|
-
// until after the runtime goes away.
|
|
434
|
-
//
|
|
435
|
-
// Therefore, in practice we should call this when the next runtime is
|
|
436
|
-
// being stood up.
|
|
437
|
-
static void clearRegistry() {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
559
|
+
// Clear the registry.
|
|
560
|
+
//
|
|
561
|
+
// Conceptually, this is called after teardown of the module (i.e. after
|
|
562
|
+
// teardown of the jsi::Runtime). However, because Rust is dropping callbacks
|
|
563
|
+
// because the Runtime is being torn down, we must keep the registry intact
|
|
564
|
+
// until after the runtime goes away.
|
|
565
|
+
//
|
|
566
|
+
// Therefore, in practice we should call this when the next runtime is
|
|
567
|
+
// being stood up.
|
|
568
|
+
static void clearRegistry() {
|
|
569
|
+
std::lock_guard<std::mutex> lock(vtableMutex);
|
|
570
|
+
vtableRegistry.clear();
|
|
571
|
+
}
|
|
441
572
|
} // namespace uniffi::zcam1_certs_utils::registry
|
|
442
573
|
|
|
443
574
|
// This calls into Rust.
|
|
444
|
-
// Implementation of callback function calling from Rust to JS
|
|
445
|
-
// RustFutureContinuationCallback
|
|
575
|
+
// Implementation of callback function calling from Rust to JS RustFutureContinuationCallback
|
|
446
576
|
|
|
447
|
-
// Callback function:
|
|
448
|
-
// uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
|
|
577
|
+
// Callback function: uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
|
|
449
578
|
//
|
|
450
579
|
// We have the following constraints:
|
|
451
580
|
// - we need to pass a function pointer to Rust.
|
|
452
581
|
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
453
582
|
// - function pointers can't store state, so we can't use a lamda.
|
|
454
583
|
//
|
|
455
|
-
// For this, we store a lambda as a global, as `rsLambda`. The `callback`
|
|
456
|
-
//
|
|
457
|
-
// into JS.
|
|
584
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
|
|
585
|
+
// the lambda, which itself calls the `body` which then calls into JS.
|
|
458
586
|
//
|
|
459
|
-
// We then give the `callback` function pointer to Rust which will call the
|
|
460
|
-
//
|
|
587
|
+
// We then give the `callback` function pointer to Rust which will call the lambda sometime in the
|
|
588
|
+
// future.
|
|
461
589
|
namespace uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback {
|
|
462
|
-
using namespace facebook;
|
|
463
|
-
|
|
464
|
-
// We need to store a lambda in a global so we can call it from
|
|
465
|
-
// a function pointer. The function pointer is passed to Rust.
|
|
466
|
-
static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
|
|
467
|
-
|
|
468
|
-
// This is the main body of the callback. It's called from the lambda,
|
|
469
|
-
// which itself is called from the callback function which is passed to Rust.
|
|
470
|
-
static void body(jsi::Runtime &rt,
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
//
|
|
500
|
-
// Answer: the module destructor calls into callback `cleanup` method,
|
|
501
|
-
// which nulls out the rsLamda.
|
|
502
|
-
//
|
|
503
|
-
// If rsLamda is null, then there is no runtime to call into.
|
|
504
|
-
if (rsLambda == nullptr) {
|
|
505
|
-
// This only occurs when destructors are calling into Rust free/drop,
|
|
506
|
-
// which causes the JS callback to be dropped.
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
590
|
+
using namespace facebook;
|
|
591
|
+
|
|
592
|
+
// We need to store a lambda in a global so we can call it from
|
|
593
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
594
|
+
static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
|
|
595
|
+
|
|
596
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
597
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
598
|
+
static void body(jsi::Runtime &rt,
|
|
599
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
600
|
+
std::shared_ptr<jsi::Value> callbackValue
|
|
601
|
+
,uint64_t rs_data
|
|
602
|
+
,int8_t rs_pollResult) {
|
|
603
|
+
|
|
604
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
605
|
+
// We'll use the Bridging class to do this…
|
|
606
|
+
auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
|
|
607
|
+
auto js_pollResult = uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
|
|
608
|
+
|
|
609
|
+
// Now we are ready to call the callback.
|
|
610
|
+
// We are already on the JS thread, because this `body` function was
|
|
611
|
+
// invoked from the CallInvoker.
|
|
612
|
+
try {
|
|
613
|
+
// Getting the callback function
|
|
614
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
615
|
+
auto uniffiResult = cb.call(rt, js_data, js_pollResult
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
} catch (const jsi::JSError &error) {
|
|
622
|
+
std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
|
|
623
|
+
<< error.what() << std::endl;
|
|
624
|
+
throw error;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
509
627
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
628
|
+
static void callback(uint64_t rs_data, int8_t rs_pollResult) {
|
|
629
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
630
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
631
|
+
//
|
|
632
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
633
|
+
// which nulls out the rsLamda.
|
|
634
|
+
//
|
|
635
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
636
|
+
if (rsLambda == nullptr) {
|
|
637
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
638
|
+
// which causes the JS callback to be dropped.
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
643
|
+
// are all in the lambda.
|
|
644
|
+
rsLambda(
|
|
645
|
+
rs_data,
|
|
646
|
+
rs_pollResult);
|
|
647
|
+
}
|
|
514
648
|
|
|
515
|
-
static UniffiRustFutureContinuationCallback
|
|
516
|
-
makeCallbackFunction( // uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
649
|
+
static UniffiRustFutureContinuationCallback
|
|
650
|
+
makeCallbackFunction( // uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback
|
|
651
|
+
jsi::Runtime &rt,
|
|
652
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
653
|
+
const jsi::Value &value) {
|
|
654
|
+
if (rsLambda != nullptr) {
|
|
655
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
656
|
+
//
|
|
657
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
658
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
659
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
660
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
661
|
+
//
|
|
662
|
+
// We can therefore return the callback function without making anything
|
|
663
|
+
// new if we've been initialized already.
|
|
664
|
+
return callback;
|
|
665
|
+
}
|
|
666
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
667
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
668
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_data, int8_t rs_pollResult) {
|
|
669
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
670
|
+
// arguments into JSI values and calling the callback.
|
|
671
|
+
uniffi_runtime::UniffiCallFunc jsLambda = [
|
|
672
|
+
callInvoker,
|
|
673
|
+
callbackValue
|
|
674
|
+
, rs_data
|
|
675
|
+
, rs_pollResult](jsi::Runtime &rt) mutable {
|
|
676
|
+
body(rt, callInvoker, callbackValue
|
|
677
|
+
, rs_data
|
|
678
|
+
, rs_pollResult);
|
|
679
|
+
};
|
|
680
|
+
// We'll then call that lambda from the callInvoker which will
|
|
681
|
+
// look after calling it on the correct thread.
|
|
682
|
+
|
|
683
|
+
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
542
684
|
};
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
547
|
-
};
|
|
548
|
-
return callback;
|
|
549
|
-
}
|
|
685
|
+
return callback;
|
|
686
|
+
}
|
|
550
687
|
|
|
551
|
-
// This method is called from the destructor of NativeZcam1CertsUtils, which
|
|
552
|
-
//
|
|
553
|
-
static void cleanup() {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
688
|
+
// This method is called from the destructor of NativeZcam1CertsUtils, which only happens
|
|
689
|
+
// when the jsi::Runtime is being destroyed.
|
|
690
|
+
static void cleanup() {
|
|
691
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled out,
|
|
692
|
+
// then the pointer will no longer be left dangling.
|
|
693
|
+
rsLambda = nullptr;
|
|
694
|
+
}
|
|
558
695
|
} // namespace uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback
|
|
559
|
-
|
|
560
|
-
|
|
696
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureFree,
|
|
697
|
+
// passed from Rust to JS as part of async callbacks.
|
|
561
698
|
namespace uniffi::zcam1_certs_utils {
|
|
562
699
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
563
700
|
|
|
564
701
|
template <> struct Bridging<UniffiForeignFutureFree> {
|
|
565
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
566
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
567
|
-
UniffiForeignFutureFree rsCallback) {
|
|
702
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureFree rsCallback) {
|
|
568
703
|
return jsi::Function::createFromHostFunction(
|
|
569
|
-
rt,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
704
|
+
rt,
|
|
705
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureFree"),
|
|
706
|
+
1,
|
|
707
|
+
[rsCallback, callInvoker](
|
|
708
|
+
jsi::Runtime &rt,
|
|
709
|
+
const jsi::Value &thisValue,
|
|
710
|
+
const jsi::Value *arguments,
|
|
711
|
+
size_t count) -> jsi::Value
|
|
712
|
+
{
|
|
713
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
714
|
+
}
|
|
715
|
+
);
|
|
576
716
|
}
|
|
577
717
|
|
|
578
|
-
static jsi::Value intoRust(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
718
|
+
static jsi::Value intoRust(
|
|
719
|
+
jsi::Runtime &rt,
|
|
720
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
721
|
+
const jsi::Value &thisValue,
|
|
722
|
+
const jsi::Value *args,
|
|
723
|
+
size_t count,
|
|
724
|
+
UniffiForeignFutureFree func) {
|
|
583
725
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
584
726
|
// then call the rs_callback with those arguments.
|
|
585
|
-
|
|
727
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0])
|
|
728
|
+
);
|
|
586
729
|
|
|
587
|
-
|
|
730
|
+
|
|
731
|
+
return jsi::Value::undefined();
|
|
588
732
|
}
|
|
589
733
|
};
|
|
590
734
|
} // namespace uniffi::zcam1_certs_utils
|
|
591
|
-
|
|
735
|
+
// Implementation of free callback function CallbackInterfaceFree
|
|
736
|
+
|
|
592
737
|
|
|
593
|
-
// Callback function:
|
|
594
|
-
// uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free::UniffiCallbackInterfaceFree
|
|
738
|
+
// Callback function: uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free::UniffiCallbackInterfaceFree
|
|
595
739
|
//
|
|
596
740
|
// We have the following constraints:
|
|
597
741
|
// - we need to pass a function pointer to Rust.
|
|
598
742
|
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
599
743
|
// - function pointers can't store state, so we can't use a lamda.
|
|
600
744
|
//
|
|
601
|
-
// For this, we store a lambda as a global, as `rsLambda`. The `callback`
|
|
602
|
-
//
|
|
603
|
-
// into JS.
|
|
745
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
|
|
746
|
+
// the lambda, which itself calls the `body` which then calls into JS.
|
|
604
747
|
//
|
|
605
|
-
// We then give the `callback` function pointer to Rust which will call the
|
|
606
|
-
//
|
|
748
|
+
// We then give the `callback` function pointer to Rust which will call the lambda sometime in the
|
|
749
|
+
// future.
|
|
607
750
|
namespace uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free {
|
|
608
|
-
using namespace facebook;
|
|
609
|
-
|
|
610
|
-
// We need to store a lambda in a global so we can call it from
|
|
611
|
-
// a function pointer. The function pointer is passed to Rust.
|
|
612
|
-
static std::function<void(uint64_t)> rsLambda = nullptr;
|
|
613
|
-
|
|
614
|
-
// This is the main body of the callback. It's called from the lambda,
|
|
615
|
-
// which itself is called from the callback function which is passed to Rust.
|
|
616
|
-
static void body(jsi::Runtime &rt,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
644
|
-
//
|
|
645
|
-
// Answer: the module destructor calls into callback `cleanup` method,
|
|
646
|
-
// which nulls out the rsLamda.
|
|
647
|
-
//
|
|
648
|
-
// If rsLamda is null, then there is no runtime to call into.
|
|
649
|
-
if (rsLambda == nullptr) {
|
|
650
|
-
// This only occurs when destructors are calling into Rust free/drop,
|
|
651
|
-
// which causes the JS callback to be dropped.
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
751
|
+
using namespace facebook;
|
|
752
|
+
|
|
753
|
+
// We need to store a lambda in a global so we can call it from
|
|
754
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
755
|
+
static std::function<void(uint64_t)> rsLambda = nullptr;
|
|
756
|
+
|
|
757
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
758
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
759
|
+
static void body(jsi::Runtime &rt,
|
|
760
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
761
|
+
std::shared_ptr<jsi::Value> callbackValue
|
|
762
|
+
,uint64_t rs_handle) {
|
|
763
|
+
|
|
764
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
765
|
+
// We'll use the Bridging class to do this…
|
|
766
|
+
auto js_handle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
|
|
767
|
+
|
|
768
|
+
// Now we are ready to call the callback.
|
|
769
|
+
// We are already on the JS thread, because this `body` function was
|
|
770
|
+
// invoked from the CallInvoker.
|
|
771
|
+
try {
|
|
772
|
+
// Getting the callback function
|
|
773
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
774
|
+
auto uniffiResult = cb.call(rt, js_handle
|
|
775
|
+
);
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
} catch (const jsi::JSError &error) {
|
|
781
|
+
std::cout << "Error in callback UniffiCallbackInterfaceFree: "
|
|
782
|
+
<< error.what() << std::endl;
|
|
783
|
+
throw error;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
654
786
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
787
|
+
static void callback(uint64_t rs_handle) {
|
|
788
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
789
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
790
|
+
//
|
|
791
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
792
|
+
// which nulls out the rsLamda.
|
|
793
|
+
//
|
|
794
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
795
|
+
if (rsLambda == nullptr) {
|
|
796
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
797
|
+
// which causes the JS callback to be dropped.
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
802
|
+
// are all in the lambda.
|
|
803
|
+
rsLambda(
|
|
804
|
+
rs_handle);
|
|
805
|
+
}
|
|
659
806
|
|
|
660
|
-
static UniffiCallbackInterfaceFree
|
|
661
|
-
makeCallbackFunction( // uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
807
|
+
static UniffiCallbackInterfaceFree
|
|
808
|
+
makeCallbackFunction( // uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free
|
|
809
|
+
jsi::Runtime &rt,
|
|
810
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
811
|
+
const jsi::Value &value) {
|
|
812
|
+
if (rsLambda != nullptr) {
|
|
813
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
814
|
+
//
|
|
815
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
816
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
817
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
818
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
819
|
+
//
|
|
820
|
+
// We can therefore return the callback function without making anything
|
|
821
|
+
// new if we've been initialized already.
|
|
822
|
+
return callback;
|
|
823
|
+
}
|
|
824
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
825
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
826
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
|
|
827
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
828
|
+
// arguments into JSI values and calling the callback.
|
|
829
|
+
uniffi_runtime::UniffiCallFunc jsLambda = [
|
|
830
|
+
callInvoker,
|
|
831
|
+
callbackValue
|
|
832
|
+
, rs_handle](jsi::Runtime &rt) mutable {
|
|
833
|
+
body(rt, callInvoker, callbackValue
|
|
834
|
+
, rs_handle);
|
|
835
|
+
};
|
|
836
|
+
// We'll then call that lambda from the callInvoker which will
|
|
837
|
+
// look after calling it on the correct thread.
|
|
838
|
+
|
|
839
|
+
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
685
840
|
};
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
690
|
-
};
|
|
691
|
-
return callback;
|
|
692
|
-
}
|
|
841
|
+
return callback;
|
|
842
|
+
}
|
|
693
843
|
|
|
694
|
-
// This method is called from the destructor of NativeZcam1CertsUtils, which
|
|
695
|
-
//
|
|
696
|
-
static void cleanup() {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
844
|
+
// This method is called from the destructor of NativeZcam1CertsUtils, which only happens
|
|
845
|
+
// when the jsi::Runtime is being destroyed.
|
|
846
|
+
static void cleanup() {
|
|
847
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled out,
|
|
848
|
+
// then the pointer will no longer be left dangling.
|
|
849
|
+
rsLambda = nullptr;
|
|
850
|
+
}
|
|
701
851
|
} // namespace uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free
|
|
702
852
|
namespace uniffi::zcam1_certs_utils {
|
|
703
853
|
using namespace facebook;
|
|
@@ -705,8 +855,9 @@ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
|
705
855
|
|
|
706
856
|
template <> struct Bridging<UniffiForeignFuture> {
|
|
707
857
|
static UniffiForeignFuture fromJs(jsi::Runtime &rt,
|
|
708
|
-
|
|
709
|
-
|
|
858
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
859
|
+
const jsi::Value &jsValue
|
|
860
|
+
) {
|
|
710
861
|
// Check if the input is an object
|
|
711
862
|
if (!jsValue.isObject()) {
|
|
712
863
|
throw jsi::JSError(rt, "Expected an object for UniffiForeignFuture");
|
|
@@ -720,10 +871,12 @@ template <> struct Bridging<UniffiForeignFuture> {
|
|
|
720
871
|
|
|
721
872
|
// Create the vtable from the js callbacks.
|
|
722
873
|
rsObject.handle = uniffi_jsi::Bridging<uint64_t>::fromJs(
|
|
723
|
-
rt, callInvoker,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
874
|
+
rt, callInvoker,
|
|
875
|
+
jsObject.getProperty(rt, "handle")
|
|
876
|
+
);
|
|
877
|
+
rsObject.free = uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free::makeCallbackFunction(
|
|
878
|
+
rt, callInvoker, jsObject.getProperty(rt, "free")
|
|
879
|
+
);
|
|
727
880
|
|
|
728
881
|
return rsObject;
|
|
729
882
|
}
|
|
@@ -735,13 +888,13 @@ using namespace facebook;
|
|
|
735
888
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
736
889
|
|
|
737
890
|
template <> struct Bridging<UniffiForeignFutureStructU8> {
|
|
738
|
-
static UniffiForeignFutureStructU8
|
|
739
|
-
|
|
740
|
-
|
|
891
|
+
static UniffiForeignFutureStructU8 fromJs(jsi::Runtime &rt,
|
|
892
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
893
|
+
const jsi::Value &jsValue
|
|
894
|
+
) {
|
|
741
895
|
// Check if the input is an object
|
|
742
896
|
if (!jsValue.isObject()) {
|
|
743
|
-
throw jsi::JSError(rt,
|
|
744
|
-
"Expected an object for UniffiForeignFutureStructU8");
|
|
897
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU8");
|
|
745
898
|
}
|
|
746
899
|
|
|
747
900
|
// Get the object from the jsi::Value
|
|
@@ -752,47 +905,55 @@ template <> struct Bridging<UniffiForeignFutureStructU8> {
|
|
|
752
905
|
|
|
753
906
|
// Create the vtable from the js callbacks.
|
|
754
907
|
rsObject.return_value = uniffi_jsi::Bridging<uint8_t>::fromJs(
|
|
755
|
-
rt, callInvoker,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
908
|
+
rt, callInvoker,
|
|
909
|
+
jsObject.getProperty(rt, "returnValue")
|
|
910
|
+
);
|
|
911
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
912
|
+
rt, callInvoker,
|
|
913
|
+
jsObject.getProperty(rt, "callStatus")
|
|
914
|
+
);
|
|
759
915
|
|
|
760
916
|
return rsObject;
|
|
761
917
|
}
|
|
762
918
|
};
|
|
763
919
|
|
|
764
920
|
} // namespace uniffi::zcam1_certs_utils
|
|
765
|
-
|
|
766
|
-
|
|
921
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteU8,
|
|
922
|
+
// passed from Rust to JS as part of async callbacks.
|
|
767
923
|
namespace uniffi::zcam1_certs_utils {
|
|
768
924
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
769
925
|
|
|
770
926
|
template <> struct Bridging<UniffiForeignFutureCompleteU8> {
|
|
771
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
772
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
773
|
-
UniffiForeignFutureCompleteU8 rsCallback) {
|
|
927
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU8 rsCallback) {
|
|
774
928
|
return jsi::Function::createFromHostFunction(
|
|
775
|
-
rt,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
929
|
+
rt,
|
|
930
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU8"),
|
|
931
|
+
2,
|
|
932
|
+
[rsCallback, callInvoker](
|
|
933
|
+
jsi::Runtime &rt,
|
|
934
|
+
const jsi::Value &thisValue,
|
|
935
|
+
const jsi::Value *arguments,
|
|
936
|
+
size_t count) -> jsi::Value
|
|
937
|
+
{
|
|
938
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
939
|
+
}
|
|
940
|
+
);
|
|
782
941
|
}
|
|
783
942
|
|
|
784
|
-
static jsi::Value intoRust(
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
943
|
+
static jsi::Value intoRust(
|
|
944
|
+
jsi::Runtime &rt,
|
|
945
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
946
|
+
const jsi::Value &thisValue,
|
|
947
|
+
const jsi::Value *args,
|
|
948
|
+
size_t count,
|
|
949
|
+
UniffiForeignFutureCompleteU8 func) {
|
|
789
950
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
790
951
|
// then call the rs_callback with those arguments.
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
UniffiForeignFutureStructU8>::fromJs(rt, callInvoker, args[1]));
|
|
952
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructU8>::fromJs(rt, callInvoker, args[1])
|
|
953
|
+
);
|
|
794
954
|
|
|
795
|
-
|
|
955
|
+
|
|
956
|
+
return jsi::Value::undefined();
|
|
796
957
|
}
|
|
797
958
|
};
|
|
798
959
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -801,13 +962,13 @@ using namespace facebook;
|
|
|
801
962
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
802
963
|
|
|
803
964
|
template <> struct Bridging<UniffiForeignFutureStructI8> {
|
|
804
|
-
static UniffiForeignFutureStructI8
|
|
805
|
-
|
|
806
|
-
|
|
965
|
+
static UniffiForeignFutureStructI8 fromJs(jsi::Runtime &rt,
|
|
966
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
967
|
+
const jsi::Value &jsValue
|
|
968
|
+
) {
|
|
807
969
|
// Check if the input is an object
|
|
808
970
|
if (!jsValue.isObject()) {
|
|
809
|
-
throw jsi::JSError(rt,
|
|
810
|
-
"Expected an object for UniffiForeignFutureStructI8");
|
|
971
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI8");
|
|
811
972
|
}
|
|
812
973
|
|
|
813
974
|
// Get the object from the jsi::Value
|
|
@@ -818,47 +979,55 @@ template <> struct Bridging<UniffiForeignFutureStructI8> {
|
|
|
818
979
|
|
|
819
980
|
// Create the vtable from the js callbacks.
|
|
820
981
|
rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
|
|
821
|
-
rt, callInvoker,
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
982
|
+
rt, callInvoker,
|
|
983
|
+
jsObject.getProperty(rt, "returnValue")
|
|
984
|
+
);
|
|
985
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
986
|
+
rt, callInvoker,
|
|
987
|
+
jsObject.getProperty(rt, "callStatus")
|
|
988
|
+
);
|
|
825
989
|
|
|
826
990
|
return rsObject;
|
|
827
991
|
}
|
|
828
992
|
};
|
|
829
993
|
|
|
830
994
|
} // namespace uniffi::zcam1_certs_utils
|
|
831
|
-
|
|
832
|
-
|
|
995
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteI8,
|
|
996
|
+
// passed from Rust to JS as part of async callbacks.
|
|
833
997
|
namespace uniffi::zcam1_certs_utils {
|
|
834
998
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
835
999
|
|
|
836
1000
|
template <> struct Bridging<UniffiForeignFutureCompleteI8> {
|
|
837
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
838
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
839
|
-
UniffiForeignFutureCompleteI8 rsCallback) {
|
|
1001
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI8 rsCallback) {
|
|
840
1002
|
return jsi::Function::createFromHostFunction(
|
|
841
|
-
rt,
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1003
|
+
rt,
|
|
1004
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI8"),
|
|
1005
|
+
2,
|
|
1006
|
+
[rsCallback, callInvoker](
|
|
1007
|
+
jsi::Runtime &rt,
|
|
1008
|
+
const jsi::Value &thisValue,
|
|
1009
|
+
const jsi::Value *arguments,
|
|
1010
|
+
size_t count) -> jsi::Value
|
|
1011
|
+
{
|
|
1012
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1013
|
+
}
|
|
1014
|
+
);
|
|
848
1015
|
}
|
|
849
1016
|
|
|
850
|
-
static jsi::Value intoRust(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
1017
|
+
static jsi::Value intoRust(
|
|
1018
|
+
jsi::Runtime &rt,
|
|
1019
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1020
|
+
const jsi::Value &thisValue,
|
|
1021
|
+
const jsi::Value *args,
|
|
1022
|
+
size_t count,
|
|
1023
|
+
UniffiForeignFutureCompleteI8 func) {
|
|
855
1024
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
856
1025
|
// then call the rs_callback with those arguments.
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
UniffiForeignFutureStructI8>::fromJs(rt, callInvoker, args[1]));
|
|
1026
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructI8>::fromJs(rt, callInvoker, args[1])
|
|
1027
|
+
);
|
|
860
1028
|
|
|
861
|
-
|
|
1029
|
+
|
|
1030
|
+
return jsi::Value::undefined();
|
|
862
1031
|
}
|
|
863
1032
|
};
|
|
864
1033
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -867,13 +1036,13 @@ using namespace facebook;
|
|
|
867
1036
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
868
1037
|
|
|
869
1038
|
template <> struct Bridging<UniffiForeignFutureStructU16> {
|
|
870
|
-
static UniffiForeignFutureStructU16
|
|
871
|
-
|
|
872
|
-
|
|
1039
|
+
static UniffiForeignFutureStructU16 fromJs(jsi::Runtime &rt,
|
|
1040
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1041
|
+
const jsi::Value &jsValue
|
|
1042
|
+
) {
|
|
873
1043
|
// Check if the input is an object
|
|
874
1044
|
if (!jsValue.isObject()) {
|
|
875
|
-
throw jsi::JSError(rt,
|
|
876
|
-
"Expected an object for UniffiForeignFutureStructU16");
|
|
1045
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU16");
|
|
877
1046
|
}
|
|
878
1047
|
|
|
879
1048
|
// Get the object from the jsi::Value
|
|
@@ -884,48 +1053,55 @@ template <> struct Bridging<UniffiForeignFutureStructU16> {
|
|
|
884
1053
|
|
|
885
1054
|
// Create the vtable from the js callbacks.
|
|
886
1055
|
rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
|
|
887
|
-
rt, callInvoker,
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1056
|
+
rt, callInvoker,
|
|
1057
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1058
|
+
);
|
|
1059
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1060
|
+
rt, callInvoker,
|
|
1061
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1062
|
+
);
|
|
891
1063
|
|
|
892
1064
|
return rsObject;
|
|
893
1065
|
}
|
|
894
1066
|
};
|
|
895
1067
|
|
|
896
1068
|
} // namespace uniffi::zcam1_certs_utils
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
// callbacks.
|
|
1069
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteU16,
|
|
1070
|
+
// passed from Rust to JS as part of async callbacks.
|
|
900
1071
|
namespace uniffi::zcam1_certs_utils {
|
|
901
1072
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
902
1073
|
|
|
903
1074
|
template <> struct Bridging<UniffiForeignFutureCompleteU16> {
|
|
904
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
905
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
906
|
-
UniffiForeignFutureCompleteU16 rsCallback) {
|
|
1075
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU16 rsCallback) {
|
|
907
1076
|
return jsi::Function::createFromHostFunction(
|
|
908
|
-
rt,
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1077
|
+
rt,
|
|
1078
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU16"),
|
|
1079
|
+
2,
|
|
1080
|
+
[rsCallback, callInvoker](
|
|
1081
|
+
jsi::Runtime &rt,
|
|
1082
|
+
const jsi::Value &thisValue,
|
|
1083
|
+
const jsi::Value *arguments,
|
|
1084
|
+
size_t count) -> jsi::Value
|
|
1085
|
+
{
|
|
1086
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1087
|
+
}
|
|
1088
|
+
);
|
|
915
1089
|
}
|
|
916
1090
|
|
|
917
|
-
static jsi::Value intoRust(
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1091
|
+
static jsi::Value intoRust(
|
|
1092
|
+
jsi::Runtime &rt,
|
|
1093
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1094
|
+
const jsi::Value &thisValue,
|
|
1095
|
+
const jsi::Value *args,
|
|
1096
|
+
size_t count,
|
|
1097
|
+
UniffiForeignFutureCompleteU16 func) {
|
|
922
1098
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
923
1099
|
// then call the rs_callback with those arguments.
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
UniffiForeignFutureStructU16>::fromJs(rt, callInvoker, args[1]));
|
|
1100
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructU16>::fromJs(rt, callInvoker, args[1])
|
|
1101
|
+
);
|
|
927
1102
|
|
|
928
|
-
|
|
1103
|
+
|
|
1104
|
+
return jsi::Value::undefined();
|
|
929
1105
|
}
|
|
930
1106
|
};
|
|
931
1107
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -934,13 +1110,13 @@ using namespace facebook;
|
|
|
934
1110
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
935
1111
|
|
|
936
1112
|
template <> struct Bridging<UniffiForeignFutureStructI16> {
|
|
937
|
-
static UniffiForeignFutureStructI16
|
|
938
|
-
|
|
939
|
-
|
|
1113
|
+
static UniffiForeignFutureStructI16 fromJs(jsi::Runtime &rt,
|
|
1114
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1115
|
+
const jsi::Value &jsValue
|
|
1116
|
+
) {
|
|
940
1117
|
// Check if the input is an object
|
|
941
1118
|
if (!jsValue.isObject()) {
|
|
942
|
-
throw jsi::JSError(rt,
|
|
943
|
-
"Expected an object for UniffiForeignFutureStructI16");
|
|
1119
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI16");
|
|
944
1120
|
}
|
|
945
1121
|
|
|
946
1122
|
// Get the object from the jsi::Value
|
|
@@ -951,48 +1127,55 @@ template <> struct Bridging<UniffiForeignFutureStructI16> {
|
|
|
951
1127
|
|
|
952
1128
|
// Create the vtable from the js callbacks.
|
|
953
1129
|
rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
|
|
954
|
-
rt, callInvoker,
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1130
|
+
rt, callInvoker,
|
|
1131
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1132
|
+
);
|
|
1133
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1134
|
+
rt, callInvoker,
|
|
1135
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1136
|
+
);
|
|
958
1137
|
|
|
959
1138
|
return rsObject;
|
|
960
1139
|
}
|
|
961
1140
|
};
|
|
962
1141
|
|
|
963
1142
|
} // namespace uniffi::zcam1_certs_utils
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
// callbacks.
|
|
1143
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteI16,
|
|
1144
|
+
// passed from Rust to JS as part of async callbacks.
|
|
967
1145
|
namespace uniffi::zcam1_certs_utils {
|
|
968
1146
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
969
1147
|
|
|
970
1148
|
template <> struct Bridging<UniffiForeignFutureCompleteI16> {
|
|
971
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
972
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
973
|
-
UniffiForeignFutureCompleteI16 rsCallback) {
|
|
1149
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI16 rsCallback) {
|
|
974
1150
|
return jsi::Function::createFromHostFunction(
|
|
975
|
-
rt,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1151
|
+
rt,
|
|
1152
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI16"),
|
|
1153
|
+
2,
|
|
1154
|
+
[rsCallback, callInvoker](
|
|
1155
|
+
jsi::Runtime &rt,
|
|
1156
|
+
const jsi::Value &thisValue,
|
|
1157
|
+
const jsi::Value *arguments,
|
|
1158
|
+
size_t count) -> jsi::Value
|
|
1159
|
+
{
|
|
1160
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1161
|
+
}
|
|
1162
|
+
);
|
|
982
1163
|
}
|
|
983
1164
|
|
|
984
|
-
static jsi::Value intoRust(
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1165
|
+
static jsi::Value intoRust(
|
|
1166
|
+
jsi::Runtime &rt,
|
|
1167
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1168
|
+
const jsi::Value &thisValue,
|
|
1169
|
+
const jsi::Value *args,
|
|
1170
|
+
size_t count,
|
|
1171
|
+
UniffiForeignFutureCompleteI16 func) {
|
|
989
1172
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
990
1173
|
// then call the rs_callback with those arguments.
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
UniffiForeignFutureStructI16>::fromJs(rt, callInvoker, args[1]));
|
|
1174
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructI16>::fromJs(rt, callInvoker, args[1])
|
|
1175
|
+
);
|
|
994
1176
|
|
|
995
|
-
|
|
1177
|
+
|
|
1178
|
+
return jsi::Value::undefined();
|
|
996
1179
|
}
|
|
997
1180
|
};
|
|
998
1181
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1001,13 +1184,13 @@ using namespace facebook;
|
|
|
1001
1184
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1002
1185
|
|
|
1003
1186
|
template <> struct Bridging<UniffiForeignFutureStructU32> {
|
|
1004
|
-
static UniffiForeignFutureStructU32
|
|
1005
|
-
|
|
1006
|
-
|
|
1187
|
+
static UniffiForeignFutureStructU32 fromJs(jsi::Runtime &rt,
|
|
1188
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1189
|
+
const jsi::Value &jsValue
|
|
1190
|
+
) {
|
|
1007
1191
|
// Check if the input is an object
|
|
1008
1192
|
if (!jsValue.isObject()) {
|
|
1009
|
-
throw jsi::JSError(rt,
|
|
1010
|
-
"Expected an object for UniffiForeignFutureStructU32");
|
|
1193
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU32");
|
|
1011
1194
|
}
|
|
1012
1195
|
|
|
1013
1196
|
// Get the object from the jsi::Value
|
|
@@ -1018,48 +1201,55 @@ template <> struct Bridging<UniffiForeignFutureStructU32> {
|
|
|
1018
1201
|
|
|
1019
1202
|
// Create the vtable from the js callbacks.
|
|
1020
1203
|
rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
|
|
1021
|
-
rt, callInvoker,
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1204
|
+
rt, callInvoker,
|
|
1205
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1206
|
+
);
|
|
1207
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1208
|
+
rt, callInvoker,
|
|
1209
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1210
|
+
);
|
|
1025
1211
|
|
|
1026
1212
|
return rsObject;
|
|
1027
1213
|
}
|
|
1028
1214
|
};
|
|
1029
1215
|
|
|
1030
1216
|
} // namespace uniffi::zcam1_certs_utils
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
// callbacks.
|
|
1217
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteU32,
|
|
1218
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1034
1219
|
namespace uniffi::zcam1_certs_utils {
|
|
1035
1220
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1036
1221
|
|
|
1037
1222
|
template <> struct Bridging<UniffiForeignFutureCompleteU32> {
|
|
1038
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1039
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1040
|
-
UniffiForeignFutureCompleteU32 rsCallback) {
|
|
1223
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU32 rsCallback) {
|
|
1041
1224
|
return jsi::Function::createFromHostFunction(
|
|
1042
|
-
rt,
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1225
|
+
rt,
|
|
1226
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU32"),
|
|
1227
|
+
2,
|
|
1228
|
+
[rsCallback, callInvoker](
|
|
1229
|
+
jsi::Runtime &rt,
|
|
1230
|
+
const jsi::Value &thisValue,
|
|
1231
|
+
const jsi::Value *arguments,
|
|
1232
|
+
size_t count) -> jsi::Value
|
|
1233
|
+
{
|
|
1234
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1235
|
+
}
|
|
1236
|
+
);
|
|
1049
1237
|
}
|
|
1050
1238
|
|
|
1051
|
-
static jsi::Value intoRust(
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1239
|
+
static jsi::Value intoRust(
|
|
1240
|
+
jsi::Runtime &rt,
|
|
1241
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1242
|
+
const jsi::Value &thisValue,
|
|
1243
|
+
const jsi::Value *args,
|
|
1244
|
+
size_t count,
|
|
1245
|
+
UniffiForeignFutureCompleteU32 func) {
|
|
1056
1246
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1057
1247
|
// then call the rs_callback with those arguments.
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
UniffiForeignFutureStructU32>::fromJs(rt, callInvoker, args[1]));
|
|
1248
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructU32>::fromJs(rt, callInvoker, args[1])
|
|
1249
|
+
);
|
|
1061
1250
|
|
|
1062
|
-
|
|
1251
|
+
|
|
1252
|
+
return jsi::Value::undefined();
|
|
1063
1253
|
}
|
|
1064
1254
|
};
|
|
1065
1255
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1068,13 +1258,13 @@ using namespace facebook;
|
|
|
1068
1258
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1069
1259
|
|
|
1070
1260
|
template <> struct Bridging<UniffiForeignFutureStructI32> {
|
|
1071
|
-
static UniffiForeignFutureStructI32
|
|
1072
|
-
|
|
1073
|
-
|
|
1261
|
+
static UniffiForeignFutureStructI32 fromJs(jsi::Runtime &rt,
|
|
1262
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1263
|
+
const jsi::Value &jsValue
|
|
1264
|
+
) {
|
|
1074
1265
|
// Check if the input is an object
|
|
1075
1266
|
if (!jsValue.isObject()) {
|
|
1076
|
-
throw jsi::JSError(rt,
|
|
1077
|
-
"Expected an object for UniffiForeignFutureStructI32");
|
|
1267
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI32");
|
|
1078
1268
|
}
|
|
1079
1269
|
|
|
1080
1270
|
// Get the object from the jsi::Value
|
|
@@ -1085,48 +1275,55 @@ template <> struct Bridging<UniffiForeignFutureStructI32> {
|
|
|
1085
1275
|
|
|
1086
1276
|
// Create the vtable from the js callbacks.
|
|
1087
1277
|
rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
|
|
1088
|
-
rt, callInvoker,
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1278
|
+
rt, callInvoker,
|
|
1279
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1280
|
+
);
|
|
1281
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1282
|
+
rt, callInvoker,
|
|
1283
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1284
|
+
);
|
|
1092
1285
|
|
|
1093
1286
|
return rsObject;
|
|
1094
1287
|
}
|
|
1095
1288
|
};
|
|
1096
1289
|
|
|
1097
1290
|
} // namespace uniffi::zcam1_certs_utils
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
// callbacks.
|
|
1291
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteI32,
|
|
1292
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1101
1293
|
namespace uniffi::zcam1_certs_utils {
|
|
1102
1294
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1103
1295
|
|
|
1104
1296
|
template <> struct Bridging<UniffiForeignFutureCompleteI32> {
|
|
1105
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1106
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1107
|
-
UniffiForeignFutureCompleteI32 rsCallback) {
|
|
1297
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI32 rsCallback) {
|
|
1108
1298
|
return jsi::Function::createFromHostFunction(
|
|
1109
|
-
rt,
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1299
|
+
rt,
|
|
1300
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI32"),
|
|
1301
|
+
2,
|
|
1302
|
+
[rsCallback, callInvoker](
|
|
1303
|
+
jsi::Runtime &rt,
|
|
1304
|
+
const jsi::Value &thisValue,
|
|
1305
|
+
const jsi::Value *arguments,
|
|
1306
|
+
size_t count) -> jsi::Value
|
|
1307
|
+
{
|
|
1308
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1116
1311
|
}
|
|
1117
1312
|
|
|
1118
|
-
static jsi::Value intoRust(
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1313
|
+
static jsi::Value intoRust(
|
|
1314
|
+
jsi::Runtime &rt,
|
|
1315
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1316
|
+
const jsi::Value &thisValue,
|
|
1317
|
+
const jsi::Value *args,
|
|
1318
|
+
size_t count,
|
|
1319
|
+
UniffiForeignFutureCompleteI32 func) {
|
|
1123
1320
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1124
1321
|
// then call the rs_callback with those arguments.
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
UniffiForeignFutureStructI32>::fromJs(rt, callInvoker, args[1]));
|
|
1322
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructI32>::fromJs(rt, callInvoker, args[1])
|
|
1323
|
+
);
|
|
1128
1324
|
|
|
1129
|
-
|
|
1325
|
+
|
|
1326
|
+
return jsi::Value::undefined();
|
|
1130
1327
|
}
|
|
1131
1328
|
};
|
|
1132
1329
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1135,13 +1332,13 @@ using namespace facebook;
|
|
|
1135
1332
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1136
1333
|
|
|
1137
1334
|
template <> struct Bridging<UniffiForeignFutureStructU64> {
|
|
1138
|
-
static UniffiForeignFutureStructU64
|
|
1139
|
-
|
|
1140
|
-
|
|
1335
|
+
static UniffiForeignFutureStructU64 fromJs(jsi::Runtime &rt,
|
|
1336
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1337
|
+
const jsi::Value &jsValue
|
|
1338
|
+
) {
|
|
1141
1339
|
// Check if the input is an object
|
|
1142
1340
|
if (!jsValue.isObject()) {
|
|
1143
|
-
throw jsi::JSError(rt,
|
|
1144
|
-
"Expected an object for UniffiForeignFutureStructU64");
|
|
1341
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU64");
|
|
1145
1342
|
}
|
|
1146
1343
|
|
|
1147
1344
|
// Get the object from the jsi::Value
|
|
@@ -1152,48 +1349,55 @@ template <> struct Bridging<UniffiForeignFutureStructU64> {
|
|
|
1152
1349
|
|
|
1153
1350
|
// Create the vtable from the js callbacks.
|
|
1154
1351
|
rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
|
|
1155
|
-
rt, callInvoker,
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1352
|
+
rt, callInvoker,
|
|
1353
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1354
|
+
);
|
|
1355
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1356
|
+
rt, callInvoker,
|
|
1357
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1358
|
+
);
|
|
1159
1359
|
|
|
1160
1360
|
return rsObject;
|
|
1161
1361
|
}
|
|
1162
1362
|
};
|
|
1163
1363
|
|
|
1164
1364
|
} // namespace uniffi::zcam1_certs_utils
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
// callbacks.
|
|
1365
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteU64,
|
|
1366
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1168
1367
|
namespace uniffi::zcam1_certs_utils {
|
|
1169
1368
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1170
1369
|
|
|
1171
1370
|
template <> struct Bridging<UniffiForeignFutureCompleteU64> {
|
|
1172
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1173
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1174
|
-
UniffiForeignFutureCompleteU64 rsCallback) {
|
|
1371
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU64 rsCallback) {
|
|
1175
1372
|
return jsi::Function::createFromHostFunction(
|
|
1176
|
-
rt,
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1373
|
+
rt,
|
|
1374
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU64"),
|
|
1375
|
+
2,
|
|
1376
|
+
[rsCallback, callInvoker](
|
|
1377
|
+
jsi::Runtime &rt,
|
|
1378
|
+
const jsi::Value &thisValue,
|
|
1379
|
+
const jsi::Value *arguments,
|
|
1380
|
+
size_t count) -> jsi::Value
|
|
1381
|
+
{
|
|
1382
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1383
|
+
}
|
|
1384
|
+
);
|
|
1183
1385
|
}
|
|
1184
1386
|
|
|
1185
|
-
static jsi::Value intoRust(
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1387
|
+
static jsi::Value intoRust(
|
|
1388
|
+
jsi::Runtime &rt,
|
|
1389
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1390
|
+
const jsi::Value &thisValue,
|
|
1391
|
+
const jsi::Value *args,
|
|
1392
|
+
size_t count,
|
|
1393
|
+
UniffiForeignFutureCompleteU64 func) {
|
|
1190
1394
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1191
1395
|
// then call the rs_callback with those arguments.
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
UniffiForeignFutureStructU64>::fromJs(rt, callInvoker, args[1]));
|
|
1396
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructU64>::fromJs(rt, callInvoker, args[1])
|
|
1397
|
+
);
|
|
1195
1398
|
|
|
1196
|
-
|
|
1399
|
+
|
|
1400
|
+
return jsi::Value::undefined();
|
|
1197
1401
|
}
|
|
1198
1402
|
};
|
|
1199
1403
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1202,13 +1406,13 @@ using namespace facebook;
|
|
|
1202
1406
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1203
1407
|
|
|
1204
1408
|
template <> struct Bridging<UniffiForeignFutureStructI64> {
|
|
1205
|
-
static UniffiForeignFutureStructI64
|
|
1206
|
-
|
|
1207
|
-
|
|
1409
|
+
static UniffiForeignFutureStructI64 fromJs(jsi::Runtime &rt,
|
|
1410
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1411
|
+
const jsi::Value &jsValue
|
|
1412
|
+
) {
|
|
1208
1413
|
// Check if the input is an object
|
|
1209
1414
|
if (!jsValue.isObject()) {
|
|
1210
|
-
throw jsi::JSError(rt,
|
|
1211
|
-
"Expected an object for UniffiForeignFutureStructI64");
|
|
1415
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI64");
|
|
1212
1416
|
}
|
|
1213
1417
|
|
|
1214
1418
|
// Get the object from the jsi::Value
|
|
@@ -1219,48 +1423,55 @@ template <> struct Bridging<UniffiForeignFutureStructI64> {
|
|
|
1219
1423
|
|
|
1220
1424
|
// Create the vtable from the js callbacks.
|
|
1221
1425
|
rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
|
|
1222
|
-
rt, callInvoker,
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1426
|
+
rt, callInvoker,
|
|
1427
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1428
|
+
);
|
|
1429
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1430
|
+
rt, callInvoker,
|
|
1431
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1432
|
+
);
|
|
1226
1433
|
|
|
1227
1434
|
return rsObject;
|
|
1228
1435
|
}
|
|
1229
1436
|
};
|
|
1230
1437
|
|
|
1231
1438
|
} // namespace uniffi::zcam1_certs_utils
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
// callbacks.
|
|
1439
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteI64,
|
|
1440
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1235
1441
|
namespace uniffi::zcam1_certs_utils {
|
|
1236
1442
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1237
1443
|
|
|
1238
1444
|
template <> struct Bridging<UniffiForeignFutureCompleteI64> {
|
|
1239
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1240
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1241
|
-
UniffiForeignFutureCompleteI64 rsCallback) {
|
|
1445
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI64 rsCallback) {
|
|
1242
1446
|
return jsi::Function::createFromHostFunction(
|
|
1243
|
-
rt,
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1447
|
+
rt,
|
|
1448
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI64"),
|
|
1449
|
+
2,
|
|
1450
|
+
[rsCallback, callInvoker](
|
|
1451
|
+
jsi::Runtime &rt,
|
|
1452
|
+
const jsi::Value &thisValue,
|
|
1453
|
+
const jsi::Value *arguments,
|
|
1454
|
+
size_t count) -> jsi::Value
|
|
1455
|
+
{
|
|
1456
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1457
|
+
}
|
|
1458
|
+
);
|
|
1250
1459
|
}
|
|
1251
1460
|
|
|
1252
|
-
static jsi::Value intoRust(
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1461
|
+
static jsi::Value intoRust(
|
|
1462
|
+
jsi::Runtime &rt,
|
|
1463
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1464
|
+
const jsi::Value &thisValue,
|
|
1465
|
+
const jsi::Value *args,
|
|
1466
|
+
size_t count,
|
|
1467
|
+
UniffiForeignFutureCompleteI64 func) {
|
|
1257
1468
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1258
1469
|
// then call the rs_callback with those arguments.
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
UniffiForeignFutureStructI64>::fromJs(rt, callInvoker, args[1]));
|
|
1470
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructI64>::fromJs(rt, callInvoker, args[1])
|
|
1471
|
+
);
|
|
1262
1472
|
|
|
1263
|
-
|
|
1473
|
+
|
|
1474
|
+
return jsi::Value::undefined();
|
|
1264
1475
|
}
|
|
1265
1476
|
};
|
|
1266
1477
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1269,13 +1480,13 @@ using namespace facebook;
|
|
|
1269
1480
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1270
1481
|
|
|
1271
1482
|
template <> struct Bridging<UniffiForeignFutureStructF32> {
|
|
1272
|
-
static UniffiForeignFutureStructF32
|
|
1273
|
-
|
|
1274
|
-
|
|
1483
|
+
static UniffiForeignFutureStructF32 fromJs(jsi::Runtime &rt,
|
|
1484
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1485
|
+
const jsi::Value &jsValue
|
|
1486
|
+
) {
|
|
1275
1487
|
// Check if the input is an object
|
|
1276
1488
|
if (!jsValue.isObject()) {
|
|
1277
|
-
throw jsi::JSError(rt,
|
|
1278
|
-
"Expected an object for UniffiForeignFutureStructF32");
|
|
1489
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructF32");
|
|
1279
1490
|
}
|
|
1280
1491
|
|
|
1281
1492
|
// Get the object from the jsi::Value
|
|
@@ -1286,48 +1497,55 @@ template <> struct Bridging<UniffiForeignFutureStructF32> {
|
|
|
1286
1497
|
|
|
1287
1498
|
// Create the vtable from the js callbacks.
|
|
1288
1499
|
rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
|
|
1289
|
-
rt, callInvoker,
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1500
|
+
rt, callInvoker,
|
|
1501
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1502
|
+
);
|
|
1503
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1504
|
+
rt, callInvoker,
|
|
1505
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1506
|
+
);
|
|
1293
1507
|
|
|
1294
1508
|
return rsObject;
|
|
1295
1509
|
}
|
|
1296
1510
|
};
|
|
1297
1511
|
|
|
1298
1512
|
} // namespace uniffi::zcam1_certs_utils
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
// callbacks.
|
|
1513
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteF32,
|
|
1514
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1302
1515
|
namespace uniffi::zcam1_certs_utils {
|
|
1303
1516
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1304
1517
|
|
|
1305
1518
|
template <> struct Bridging<UniffiForeignFutureCompleteF32> {
|
|
1306
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1307
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1308
|
-
UniffiForeignFutureCompleteF32 rsCallback) {
|
|
1519
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteF32 rsCallback) {
|
|
1309
1520
|
return jsi::Function::createFromHostFunction(
|
|
1310
|
-
rt,
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1521
|
+
rt,
|
|
1522
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF32"),
|
|
1523
|
+
2,
|
|
1524
|
+
[rsCallback, callInvoker](
|
|
1525
|
+
jsi::Runtime &rt,
|
|
1526
|
+
const jsi::Value &thisValue,
|
|
1527
|
+
const jsi::Value *arguments,
|
|
1528
|
+
size_t count) -> jsi::Value
|
|
1529
|
+
{
|
|
1530
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1531
|
+
}
|
|
1532
|
+
);
|
|
1317
1533
|
}
|
|
1318
1534
|
|
|
1319
|
-
static jsi::Value intoRust(
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1535
|
+
static jsi::Value intoRust(
|
|
1536
|
+
jsi::Runtime &rt,
|
|
1537
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1538
|
+
const jsi::Value &thisValue,
|
|
1539
|
+
const jsi::Value *args,
|
|
1540
|
+
size_t count,
|
|
1541
|
+
UniffiForeignFutureCompleteF32 func) {
|
|
1324
1542
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1325
1543
|
// then call the rs_callback with those arguments.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
UniffiForeignFutureStructF32>::fromJs(rt, callInvoker, args[1]));
|
|
1544
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructF32>::fromJs(rt, callInvoker, args[1])
|
|
1545
|
+
);
|
|
1329
1546
|
|
|
1330
|
-
|
|
1547
|
+
|
|
1548
|
+
return jsi::Value::undefined();
|
|
1331
1549
|
}
|
|
1332
1550
|
};
|
|
1333
1551
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1336,13 +1554,13 @@ using namespace facebook;
|
|
|
1336
1554
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1337
1555
|
|
|
1338
1556
|
template <> struct Bridging<UniffiForeignFutureStructF64> {
|
|
1339
|
-
static UniffiForeignFutureStructF64
|
|
1340
|
-
|
|
1341
|
-
|
|
1557
|
+
static UniffiForeignFutureStructF64 fromJs(jsi::Runtime &rt,
|
|
1558
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1559
|
+
const jsi::Value &jsValue
|
|
1560
|
+
) {
|
|
1342
1561
|
// Check if the input is an object
|
|
1343
1562
|
if (!jsValue.isObject()) {
|
|
1344
|
-
throw jsi::JSError(rt,
|
|
1345
|
-
"Expected an object for UniffiForeignFutureStructF64");
|
|
1563
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructF64");
|
|
1346
1564
|
}
|
|
1347
1565
|
|
|
1348
1566
|
// Get the object from the jsi::Value
|
|
@@ -1353,48 +1571,55 @@ template <> struct Bridging<UniffiForeignFutureStructF64> {
|
|
|
1353
1571
|
|
|
1354
1572
|
// Create the vtable from the js callbacks.
|
|
1355
1573
|
rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
|
|
1356
|
-
rt, callInvoker,
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1574
|
+
rt, callInvoker,
|
|
1575
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1576
|
+
);
|
|
1577
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1578
|
+
rt, callInvoker,
|
|
1579
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1580
|
+
);
|
|
1360
1581
|
|
|
1361
1582
|
return rsObject;
|
|
1362
1583
|
}
|
|
1363
1584
|
};
|
|
1364
1585
|
|
|
1365
1586
|
} // namespace uniffi::zcam1_certs_utils
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
// callbacks.
|
|
1587
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteF64,
|
|
1588
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1369
1589
|
namespace uniffi::zcam1_certs_utils {
|
|
1370
1590
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1371
1591
|
|
|
1372
1592
|
template <> struct Bridging<UniffiForeignFutureCompleteF64> {
|
|
1373
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1374
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1375
|
-
UniffiForeignFutureCompleteF64 rsCallback) {
|
|
1593
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteF64 rsCallback) {
|
|
1376
1594
|
return jsi::Function::createFromHostFunction(
|
|
1377
|
-
rt,
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1595
|
+
rt,
|
|
1596
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF64"),
|
|
1597
|
+
2,
|
|
1598
|
+
[rsCallback, callInvoker](
|
|
1599
|
+
jsi::Runtime &rt,
|
|
1600
|
+
const jsi::Value &thisValue,
|
|
1601
|
+
const jsi::Value *arguments,
|
|
1602
|
+
size_t count) -> jsi::Value
|
|
1603
|
+
{
|
|
1604
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1605
|
+
}
|
|
1606
|
+
);
|
|
1384
1607
|
}
|
|
1385
1608
|
|
|
1386
|
-
static jsi::Value intoRust(
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1609
|
+
static jsi::Value intoRust(
|
|
1610
|
+
jsi::Runtime &rt,
|
|
1611
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1612
|
+
const jsi::Value &thisValue,
|
|
1613
|
+
const jsi::Value *args,
|
|
1614
|
+
size_t count,
|
|
1615
|
+
UniffiForeignFutureCompleteF64 func) {
|
|
1391
1616
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1392
1617
|
// then call the rs_callback with those arguments.
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
UniffiForeignFutureStructF64>::fromJs(rt, callInvoker, args[1]));
|
|
1618
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructF64>::fromJs(rt, callInvoker, args[1])
|
|
1619
|
+
);
|
|
1396
1620
|
|
|
1397
|
-
|
|
1621
|
+
|
|
1622
|
+
return jsi::Value::undefined();
|
|
1398
1623
|
}
|
|
1399
1624
|
};
|
|
1400
1625
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1403,13 +1628,13 @@ using namespace facebook;
|
|
|
1403
1628
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1404
1629
|
|
|
1405
1630
|
template <> struct Bridging<UniffiForeignFutureStructPointer> {
|
|
1406
|
-
static UniffiForeignFutureStructPointer
|
|
1407
|
-
|
|
1408
|
-
|
|
1631
|
+
static UniffiForeignFutureStructPointer fromJs(jsi::Runtime &rt,
|
|
1632
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1633
|
+
const jsi::Value &jsValue
|
|
1634
|
+
) {
|
|
1409
1635
|
// Check if the input is an object
|
|
1410
1636
|
if (!jsValue.isObject()) {
|
|
1411
|
-
throw jsi::JSError(
|
|
1412
|
-
rt, "Expected an object for UniffiForeignFutureStructPointer");
|
|
1637
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructPointer");
|
|
1413
1638
|
}
|
|
1414
1639
|
|
|
1415
1640
|
// Get the object from the jsi::Value
|
|
@@ -1420,49 +1645,55 @@ template <> struct Bridging<UniffiForeignFutureStructPointer> {
|
|
|
1420
1645
|
|
|
1421
1646
|
// Create the vtable from the js callbacks.
|
|
1422
1647
|
rsObject.return_value = uniffi_jsi::Bridging<void *>::fromJs(
|
|
1423
|
-
rt, callInvoker,
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1648
|
+
rt, callInvoker,
|
|
1649
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1650
|
+
);
|
|
1651
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1652
|
+
rt, callInvoker,
|
|
1653
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1654
|
+
);
|
|
1427
1655
|
|
|
1428
1656
|
return rsObject;
|
|
1429
1657
|
}
|
|
1430
1658
|
};
|
|
1431
1659
|
|
|
1432
1660
|
} // namespace uniffi::zcam1_certs_utils
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
// callbacks.
|
|
1661
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompletePointer,
|
|
1662
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1436
1663
|
namespace uniffi::zcam1_certs_utils {
|
|
1437
1664
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1438
1665
|
|
|
1439
1666
|
template <> struct Bridging<UniffiForeignFutureCompletePointer> {
|
|
1440
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1441
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1442
|
-
UniffiForeignFutureCompletePointer rsCallback) {
|
|
1667
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompletePointer rsCallback) {
|
|
1443
1668
|
return jsi::Function::createFromHostFunction(
|
|
1444
|
-
rt,
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1669
|
+
rt,
|
|
1670
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompletePointer"),
|
|
1671
|
+
2,
|
|
1672
|
+
[rsCallback, callInvoker](
|
|
1673
|
+
jsi::Runtime &rt,
|
|
1674
|
+
const jsi::Value &thisValue,
|
|
1675
|
+
const jsi::Value *arguments,
|
|
1676
|
+
size_t count) -> jsi::Value
|
|
1677
|
+
{
|
|
1678
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1679
|
+
}
|
|
1680
|
+
);
|
|
1451
1681
|
}
|
|
1452
1682
|
|
|
1453
|
-
static jsi::Value intoRust(
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1683
|
+
static jsi::Value intoRust(
|
|
1684
|
+
jsi::Runtime &rt,
|
|
1685
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1686
|
+
const jsi::Value &thisValue,
|
|
1687
|
+
const jsi::Value *args,
|
|
1688
|
+
size_t count,
|
|
1689
|
+
UniffiForeignFutureCompletePointer func) {
|
|
1458
1690
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1459
1691
|
// then call the rs_callback with those arguments.
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
UniffiForeignFutureStructPointer>::fromJs(rt, callInvoker,
|
|
1463
|
-
args[1]));
|
|
1692
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructPointer>::fromJs(rt, callInvoker, args[1])
|
|
1693
|
+
);
|
|
1464
1694
|
|
|
1465
|
-
|
|
1695
|
+
|
|
1696
|
+
return jsi::Value::undefined();
|
|
1466
1697
|
}
|
|
1467
1698
|
};
|
|
1468
1699
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1471,13 +1702,13 @@ using namespace facebook;
|
|
|
1471
1702
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1472
1703
|
|
|
1473
1704
|
template <> struct Bridging<UniffiForeignFutureStructRustBuffer> {
|
|
1474
|
-
static UniffiForeignFutureStructRustBuffer
|
|
1475
|
-
|
|
1476
|
-
|
|
1705
|
+
static UniffiForeignFutureStructRustBuffer fromJs(jsi::Runtime &rt,
|
|
1706
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1707
|
+
const jsi::Value &jsValue
|
|
1708
|
+
) {
|
|
1477
1709
|
// Check if the input is an object
|
|
1478
1710
|
if (!jsValue.isObject()) {
|
|
1479
|
-
throw jsi::JSError(
|
|
1480
|
-
rt, "Expected an object for UniffiForeignFutureStructRustBuffer");
|
|
1711
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructRustBuffer");
|
|
1481
1712
|
}
|
|
1482
1713
|
|
|
1483
1714
|
// Get the object from the jsi::Value
|
|
@@ -1487,52 +1718,56 @@ template <> struct Bridging<UniffiForeignFutureStructRustBuffer> {
|
|
|
1487
1718
|
UniffiForeignFutureStructRustBuffer rsObject;
|
|
1488
1719
|
|
|
1489
1720
|
// Create the vtable from the js callbacks.
|
|
1490
|
-
rsObject.return_value =
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1721
|
+
rsObject.return_value = uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(
|
|
1722
|
+
rt, callInvoker,
|
|
1723
|
+
jsObject.getProperty(rt, "returnValue")
|
|
1724
|
+
);
|
|
1725
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1726
|
+
rt, callInvoker,
|
|
1727
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1728
|
+
);
|
|
1496
1729
|
|
|
1497
1730
|
return rsObject;
|
|
1498
1731
|
}
|
|
1499
1732
|
};
|
|
1500
1733
|
|
|
1501
1734
|
} // namespace uniffi::zcam1_certs_utils
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
// callbacks.
|
|
1735
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteRustBuffer,
|
|
1736
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1505
1737
|
namespace uniffi::zcam1_certs_utils {
|
|
1506
1738
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1507
1739
|
|
|
1508
1740
|
template <> struct Bridging<UniffiForeignFutureCompleteRustBuffer> {
|
|
1509
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1510
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1511
|
-
UniffiForeignFutureCompleteRustBuffer rsCallback) {
|
|
1741
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteRustBuffer rsCallback) {
|
|
1512
1742
|
return jsi::Function::createFromHostFunction(
|
|
1513
|
-
rt,
|
|
1743
|
+
rt,
|
|
1744
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
|
|
1514
1745
|
2,
|
|
1515
|
-
[rsCallback, callInvoker](
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1746
|
+
[rsCallback, callInvoker](
|
|
1747
|
+
jsi::Runtime &rt,
|
|
1748
|
+
const jsi::Value &thisValue,
|
|
1749
|
+
const jsi::Value *arguments,
|
|
1750
|
+
size_t count) -> jsi::Value
|
|
1751
|
+
{
|
|
1752
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1753
|
+
}
|
|
1754
|
+
);
|
|
1521
1755
|
}
|
|
1522
1756
|
|
|
1523
|
-
static jsi::Value intoRust(
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1757
|
+
static jsi::Value intoRust(
|
|
1758
|
+
jsi::Runtime &rt,
|
|
1759
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1760
|
+
const jsi::Value &thisValue,
|
|
1761
|
+
const jsi::Value *args,
|
|
1762
|
+
size_t count,
|
|
1763
|
+
UniffiForeignFutureCompleteRustBuffer func) {
|
|
1528
1764
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1529
1765
|
// then call the rs_callback with those arguments.
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
UniffiForeignFutureStructRustBuffer>::fromJs(rt, callInvoker,
|
|
1533
|
-
args[1]));
|
|
1766
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructRustBuffer>::fromJs(rt, callInvoker, args[1])
|
|
1767
|
+
);
|
|
1534
1768
|
|
|
1535
|
-
|
|
1769
|
+
|
|
1770
|
+
return jsi::Value::undefined();
|
|
1536
1771
|
}
|
|
1537
1772
|
};
|
|
1538
1773
|
} // namespace uniffi::zcam1_certs_utils
|
|
@@ -1541,13 +1776,13 @@ using namespace facebook;
|
|
|
1541
1776
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1542
1777
|
|
|
1543
1778
|
template <> struct Bridging<UniffiForeignFutureStructVoid> {
|
|
1544
|
-
static UniffiForeignFutureStructVoid
|
|
1545
|
-
|
|
1546
|
-
|
|
1779
|
+
static UniffiForeignFutureStructVoid fromJs(jsi::Runtime &rt,
|
|
1780
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1781
|
+
const jsi::Value &jsValue
|
|
1782
|
+
) {
|
|
1547
1783
|
// Check if the input is an object
|
|
1548
1784
|
if (!jsValue.isObject()) {
|
|
1549
|
-
throw jsi::JSError(
|
|
1550
|
-
rt, "Expected an object for UniffiForeignFutureStructVoid");
|
|
1785
|
+
throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructVoid");
|
|
1551
1786
|
}
|
|
1552
1787
|
|
|
1553
1788
|
// Get the object from the jsi::Value
|
|
@@ -1557,62 +1792,73 @@ template <> struct Bridging<UniffiForeignFutureStructVoid> {
|
|
|
1557
1792
|
UniffiForeignFutureStructVoid rsObject;
|
|
1558
1793
|
|
|
1559
1794
|
// Create the vtable from the js callbacks.
|
|
1560
|
-
rsObject.call_status =
|
|
1561
|
-
|
|
1562
|
-
|
|
1795
|
+
rsObject.call_status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
|
|
1796
|
+
rt, callInvoker,
|
|
1797
|
+
jsObject.getProperty(rt, "callStatus")
|
|
1798
|
+
);
|
|
1563
1799
|
|
|
1564
1800
|
return rsObject;
|
|
1565
1801
|
}
|
|
1566
1802
|
};
|
|
1567
1803
|
|
|
1568
1804
|
} // namespace uniffi::zcam1_certs_utils
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
// callbacks.
|
|
1805
|
+
// Implementation of callback function calling from JS to Rust ForeignFutureCompleteVoid,
|
|
1806
|
+
// passed from Rust to JS as part of async callbacks.
|
|
1572
1807
|
namespace uniffi::zcam1_certs_utils {
|
|
1573
1808
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1574
1809
|
|
|
1575
1810
|
template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
|
|
1576
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1577
|
-
std::shared_ptr<CallInvoker> callInvoker,
|
|
1578
|
-
UniffiForeignFutureCompleteVoid rsCallback) {
|
|
1811
|
+
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteVoid rsCallback) {
|
|
1579
1812
|
return jsi::Function::createFromHostFunction(
|
|
1580
|
-
rt,
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1813
|
+
rt,
|
|
1814
|
+
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteVoid"),
|
|
1815
|
+
2,
|
|
1816
|
+
[rsCallback, callInvoker](
|
|
1817
|
+
jsi::Runtime &rt,
|
|
1818
|
+
const jsi::Value &thisValue,
|
|
1819
|
+
const jsi::Value *arguments,
|
|
1820
|
+
size_t count) -> jsi::Value
|
|
1821
|
+
{
|
|
1822
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1823
|
+
}
|
|
1824
|
+
);
|
|
1587
1825
|
}
|
|
1588
1826
|
|
|
1589
|
-
static jsi::Value intoRust(
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1827
|
+
static jsi::Value intoRust(
|
|
1828
|
+
jsi::Runtime &rt,
|
|
1829
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1830
|
+
const jsi::Value &thisValue,
|
|
1831
|
+
const jsi::Value *args,
|
|
1832
|
+
size_t count,
|
|
1833
|
+
UniffiForeignFutureCompleteVoid func) {
|
|
1594
1834
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1595
1835
|
// then call the rs_callback with those arguments.
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
UniffiForeignFutureStructVoid>::fromJs(rt, callInvoker, args[1]));
|
|
1836
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<UniffiForeignFutureStructVoid>::fromJs(rt, callInvoker, args[1])
|
|
1837
|
+
);
|
|
1599
1838
|
|
|
1600
|
-
|
|
1839
|
+
|
|
1840
|
+
return jsi::Value::undefined();
|
|
1601
1841
|
}
|
|
1602
1842
|
};
|
|
1603
1843
|
} // namespace uniffi::zcam1_certs_utils
|
|
1604
1844
|
|
|
1845
|
+
|
|
1605
1846
|
namespace uniffi::zcam1_certs_utils {
|
|
1606
1847
|
using namespace facebook;
|
|
1607
1848
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1608
1849
|
|
|
1609
1850
|
template <> struct Bridging<UniffiRustFutureContinuationCallback> {
|
|
1610
|
-
static UniffiRustFutureContinuationCallback
|
|
1611
|
-
|
|
1612
|
-
|
|
1851
|
+
static UniffiRustFutureContinuationCallback fromJs(
|
|
1852
|
+
jsi::Runtime &rt,
|
|
1853
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1854
|
+
const jsi::Value &value
|
|
1855
|
+
) {
|
|
1613
1856
|
try {
|
|
1614
|
-
return uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::
|
|
1615
|
-
|
|
1857
|
+
return uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::makeCallbackFunction(
|
|
1858
|
+
rt,
|
|
1859
|
+
callInvoker,
|
|
1860
|
+
value
|
|
1861
|
+
);
|
|
1616
1862
|
} catch (const std::logic_error &e) {
|
|
1617
1863
|
throw jsi::JSError(rt, e.what());
|
|
1618
1864
|
}
|
|
@@ -1623,177 +1869,133 @@ template <> struct Bridging<UniffiRustFutureContinuationCallback> {
|
|
|
1623
1869
|
|
|
1624
1870
|
NativeZcam1CertsUtils::NativeZcam1CertsUtils(
|
|
1625
1871
|
jsi::Runtime &rt,
|
|
1626
|
-
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zcam1_certs_utils_checksum_"
|
|
1678
|
-
"func_build_self_signed_certificate"),
|
|
1679
|
-
0,
|
|
1680
|
-
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1681
|
-
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1682
|
-
return this
|
|
1683
|
-
->cpp_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(
|
|
1684
|
-
rt, thisVal, args, count);
|
|
1685
|
-
});
|
|
1686
|
-
props["ubrn_ffi_zcam1_certs_utils_uniffi_contract_version"] =
|
|
1687
|
-
jsi::Function::createFromHostFunction(
|
|
1688
|
-
rt,
|
|
1689
|
-
jsi::PropNameID::forAscii(
|
|
1690
|
-
rt, "ubrn_ffi_zcam1_certs_utils_uniffi_contract_version"),
|
|
1691
|
-
0,
|
|
1692
|
-
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1693
|
-
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1694
|
-
return this->cpp_ffi_zcam1_certs_utils_uniffi_contract_version(
|
|
1695
|
-
rt, thisVal, args, count);
|
|
1696
|
-
});
|
|
1872
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker
|
|
1873
|
+
) : callInvoker(invoker), props() {
|
|
1874
|
+
// Map from Javascript names to the cpp names
|
|
1875
|
+
props["ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"] = jsi::Function::createFromHostFunction(
|
|
1876
|
+
rt,
|
|
1877
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"),
|
|
1878
|
+
1,
|
|
1879
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1880
|
+
return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(rt, thisVal, args, count);
|
|
1881
|
+
}
|
|
1882
|
+
);
|
|
1883
|
+
props["ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"] = jsi::Function::createFromHostFunction(
|
|
1884
|
+
rt,
|
|
1885
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"),
|
|
1886
|
+
1,
|
|
1887
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1888
|
+
return this->cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(rt, thisVal, args, count);
|
|
1889
|
+
}
|
|
1890
|
+
);
|
|
1891
|
+
props["ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"] = jsi::Function::createFromHostFunction(
|
|
1892
|
+
rt,
|
|
1893
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"),
|
|
1894
|
+
1,
|
|
1895
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1896
|
+
return this->cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(rt, thisVal, args, count);
|
|
1897
|
+
}
|
|
1898
|
+
);
|
|
1899
|
+
props["ubrn_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate"] = jsi::Function::createFromHostFunction(
|
|
1900
|
+
rt,
|
|
1901
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate"),
|
|
1902
|
+
2,
|
|
1903
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1904
|
+
return this->cpp_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(rt, thisVal, args, count);
|
|
1905
|
+
}
|
|
1906
|
+
);
|
|
1907
|
+
props["ubrn_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate"] = jsi::Function::createFromHostFunction(
|
|
1908
|
+
rt,
|
|
1909
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate"),
|
|
1910
|
+
0,
|
|
1911
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1912
|
+
return this->cpp_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(rt, thisVal, args, count);
|
|
1913
|
+
}
|
|
1914
|
+
);
|
|
1915
|
+
props["ubrn_ffi_zcam1_certs_utils_uniffi_contract_version"] = jsi::Function::createFromHostFunction(
|
|
1916
|
+
rt,
|
|
1917
|
+
jsi::PropNameID::forAscii(rt, "ubrn_ffi_zcam1_certs_utils_uniffi_contract_version"),
|
|
1918
|
+
0,
|
|
1919
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1920
|
+
return this->cpp_ffi_zcam1_certs_utils_uniffi_contract_version(rt, thisVal, args, count);
|
|
1921
|
+
}
|
|
1922
|
+
);
|
|
1697
1923
|
}
|
|
1698
1924
|
|
|
1699
|
-
void NativeZcam1CertsUtils::registerModule(
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
auto obj = rt.global().createFromHostObject(rt, tm);
|
|
1705
|
-
rt.global().setProperty(rt, "NativeZcam1CertsUtils", obj);
|
|
1925
|
+
void NativeZcam1CertsUtils::registerModule(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker) {
|
|
1926
|
+
auto invoker = std::make_shared<uniffi_runtime::UniffiCallInvoker>(callInvoker);
|
|
1927
|
+
auto tm = std::make_shared<NativeZcam1CertsUtils>(rt, invoker);
|
|
1928
|
+
auto obj = rt.global().createFromHostObject(rt, tm);
|
|
1929
|
+
rt.global().setProperty(rt, "NativeZcam1CertsUtils", obj);
|
|
1706
1930
|
}
|
|
1707
1931
|
|
|
1708
1932
|
void NativeZcam1CertsUtils::unregisterModule(jsi::Runtime &rt) {
|
|
1709
|
-
|
|
1933
|
+
uniffi::zcam1_certs_utils::registry::clearRegistry();
|
|
1710
1934
|
}
|
|
1711
1935
|
|
|
1712
|
-
jsi::Value NativeZcam1CertsUtils::get(jsi::Runtime
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1936
|
+
jsi::Value NativeZcam1CertsUtils::get(jsi::Runtime& rt, const jsi::PropNameID& name) {
|
|
1937
|
+
try {
|
|
1938
|
+
return jsi::Value(rt, props.at(name.utf8(rt)));
|
|
1939
|
+
}
|
|
1940
|
+
catch (std::out_of_range &e) {
|
|
1941
|
+
return jsi::Value::undefined();
|
|
1942
|
+
}
|
|
1719
1943
|
}
|
|
1720
1944
|
|
|
1721
|
-
std::vector<jsi::PropNameID>
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
return rval;
|
|
1945
|
+
std::vector<jsi::PropNameID> NativeZcam1CertsUtils::getPropertyNames(jsi::Runtime& rt) {
|
|
1946
|
+
std::vector<jsi::PropNameID> rval;
|
|
1947
|
+
for (auto& [key, value] : props) {
|
|
1948
|
+
rval.push_back(jsi::PropNameID::forUtf8(rt, key));
|
|
1949
|
+
}
|
|
1950
|
+
return rval;
|
|
1728
1951
|
}
|
|
1729
1952
|
|
|
1730
|
-
void NativeZcam1CertsUtils::set(jsi::Runtime
|
|
1731
|
-
|
|
1732
|
-
props.insert_or_assign(name.utf8(rt), &value);
|
|
1953
|
+
void NativeZcam1CertsUtils::set(jsi::Runtime& rt, const jsi::PropNameID& name, const jsi::Value& value) {
|
|
1954
|
+
props.insert_or_assign(name.utf8(rt), &value);
|
|
1733
1955
|
}
|
|
1734
1956
|
|
|
1735
1957
|
NativeZcam1CertsUtils::~NativeZcam1CertsUtils() {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1958
|
+
// Cleanup for callback function RustFutureContinuationCallback
|
|
1959
|
+
uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::cleanup();
|
|
1960
|
+
// Cleanup for "free" callback function CallbackInterfaceFree
|
|
1961
|
+
uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free::cleanup();
|
|
1740
1962
|
}
|
|
1741
1963
|
|
|
1742
1964
|
// Utility functions for serialization/deserialization of strings.
|
|
1743
|
-
jsi::Value
|
|
1744
|
-
|
|
1745
|
-
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1746
|
-
size_t count) {
|
|
1747
|
-
return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
|
|
1965
|
+
jsi::Value NativeZcam1CertsUtils::cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
1966
|
+
return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
|
|
1748
1967
|
}
|
|
1749
1968
|
|
|
1750
|
-
jsi::Value
|
|
1751
|
-
|
|
1752
|
-
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1753
|
-
size_t count) {
|
|
1754
|
-
return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
|
|
1969
|
+
jsi::Value NativeZcam1CertsUtils::cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
1970
|
+
return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
|
|
1755
1971
|
}
|
|
1756
1972
|
|
|
1757
|
-
jsi::Value
|
|
1758
|
-
|
|
1759
|
-
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1760
|
-
size_t count) {
|
|
1761
|
-
return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
|
|
1973
|
+
jsi::Value NativeZcam1CertsUtils::cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
1974
|
+
return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
|
|
1762
1975
|
}
|
|
1763
1976
|
|
|
1764
1977
|
// Methods calling directly into the uniffi generated C API of the Rust crate.
|
|
1765
|
-
jsi::Value NativeZcam1CertsUtils::
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
1775
|
-
args[1]),
|
|
1776
|
-
&status);
|
|
1777
|
-
uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::copyIntoJs(
|
|
1778
|
-
rt, callInvoker, status, args[count - 1]);
|
|
1779
|
-
|
|
1780
|
-
return uniffi::zcam1_certs_utils::Bridging<RustBuffer>::toJs(rt, callInvoker,
|
|
1781
|
-
value);
|
|
1978
|
+
jsi::Value NativeZcam1CertsUtils::cpp_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
1979
|
+
RustCallStatus status = uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1980
|
+
auto value = uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
|
|
1981
|
+
&status
|
|
1982
|
+
);
|
|
1983
|
+
uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
return uniffi::zcam1_certs_utils::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
|
|
1782
1987
|
}
|
|
1783
|
-
jsi::Value NativeZcam1CertsUtils::
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
1988
|
+
jsi::Value NativeZcam1CertsUtils::cpp_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
1989
|
+
auto value = uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(
|
|
1990
|
+
);
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
1791
1994
|
}
|
|
1792
|
-
jsi::Value
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
size_t count) {
|
|
1796
|
-
auto value = ffi_zcam1_certs_utils_uniffi_contract_version();
|
|
1995
|
+
jsi::Value NativeZcam1CertsUtils::cpp_ffi_zcam1_certs_utils_uniffi_contract_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
1996
|
+
auto value = ffi_zcam1_certs_utils_uniffi_contract_version(
|
|
1997
|
+
);
|
|
1797
1998
|
|
|
1798
|
-
|
|
1999
|
+
|
|
2000
|
+
return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
|
|
1799
2001
|
}
|