react-native-nobodywho 5.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Nobodywho.podspec +25 -20
- package/README.md +8 -8
- package/android/CMakeLists.txt +4 -15
- package/android/build.gradle +4 -5
- package/android/proguard-rules.pro +6 -0
- package/android/src/main/AndroidManifest.xml +4 -1
- package/android/src/main/AndroidManifestNew.xml +3 -0
- package/{generated/cpp → cpp/generated}/nobodywho.cpp +424 -66
- package/{generated/cpp → cpp/generated}/nobodywho.hpp +26 -2
- package/cpp/react-native-nobodywho.cpp +1 -1
- package/package.json +28 -14
- package/src/generated/index.ts +2 -0
- package/src/generated/jsi/nobodywho-ffi.ts +937 -0
- package/src/generated/jsi/nobodywho.ts +7421 -0
- package/src/index.ts +23 -0
- package/src/{chat.ts → wrapper/chat.ts} +1 -1
- package/src/wrapper/convert_value.ts +47 -0
- package/src/{cross_encoder.ts → wrapper/cross_encoder.ts} +1 -1
- package/src/wrapper/decision.ts +112 -0
- package/src/{encoder.ts → wrapper/encoder.ts} +1 -1
- package/src/{wrapper.ts → wrapper/index.ts} +11 -24
- package/src/{message.ts → wrapper/message.ts} +1 -1
- package/src/{model.ts → wrapper/model.ts} +3 -2
- package/src/{prompt.ts → wrapper/prompt.ts} +1 -1
- package/src/{sampler_presets.ts → wrapper/sampler_presets.ts} +1 -1
- package/src/{speech_to_text.ts → wrapper/speech_to_text.ts} +2 -2
- package/src/{streaming.ts → wrapper/streaming.ts} +1 -1
- package/src/{text_to_speech.ts → wrapper/text_to_speech.ts} +1 -1
- package/src/{tool.ts → wrapper/tool.ts} +2 -51
- package/src/{vad.ts → wrapper/vad.ts} +3 -3
- package/ubrn.config.yaml +26 -5
- package/cpp/nobodywho-react-native.cpp +0 -16
- package/cpp/nobodywho-react-native.h +0 -15
- package/generated/ts/nobodywho-ffi.ts +0 -414
- package/generated/ts/nobodywho.ts +0 -5470
- package/src/index.tsx +0 -41
|
@@ -188,6 +188,15 @@ void uniffi_nobodywho_uniffi_fn_free_rustcrossencoder(
|
|
|
188
188
|
/*handle*/ uint64_t
|
|
189
189
|
uniffi_nobodywho_uniffi_fn_method_rustcrossencoder_rank_and_sort_json(
|
|
190
190
|
/*handle*/ uint64_t ptr, RustBuffer query, RustBuffer documents);
|
|
191
|
+
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_clone_rustdecision(
|
|
192
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
193
|
+
void uniffi_nobodywho_uniffi_fn_free_rustdecision(
|
|
194
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
195
|
+
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_constructor_rustdecision_new(
|
|
196
|
+
/*handle*/ uint64_t model, RustBuffer n_ctx,
|
|
197
|
+
RustCallStatus *uniffi_out_err);
|
|
198
|
+
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_method_rustdecision_decide(
|
|
199
|
+
/*handle*/ uint64_t ptr, RustBuffer state_json, RustBuffer questions_json);
|
|
191
200
|
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_clone_rustencoder(
|
|
192
201
|
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
193
202
|
void uniffi_nobodywho_uniffi_fn_free_rustencoder(
|
|
@@ -581,6 +590,7 @@ uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt();
|
|
|
581
590
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank();
|
|
582
591
|
uint16_t
|
|
583
592
|
uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank_and_sort_json();
|
|
593
|
+
uint16_t uniffi_nobodywho_uniffi_checksum_method_rustdecision_decide();
|
|
584
594
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode();
|
|
585
595
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode_batch();
|
|
586
596
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx();
|
|
@@ -635,6 +645,7 @@ uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_xtc();
|
|
|
635
645
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json();
|
|
636
646
|
uint16_t uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new();
|
|
637
647
|
uint16_t uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new();
|
|
648
|
+
uint16_t uniffi_nobodywho_uniffi_checksum_constructor_rustdecision_new();
|
|
638
649
|
uint16_t uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new();
|
|
639
650
|
uint16_t uniffi_nobodywho_uniffi_checksum_constructor_rustspeechtotext_new();
|
|
640
651
|
uint16_t uniffi_nobodywho_uniffi_checksum_constructor_rusttexttospeech_new();
|
|
@@ -697,6 +708,47 @@ template <> struct Bridging<RustBuffer> {
|
|
|
697
708
|
static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
|
|
698
709
|
const jsi::Value &value) {
|
|
699
710
|
try {
|
|
711
|
+
auto obj = value.asObject(rt);
|
|
712
|
+
|
|
713
|
+
// Adoption vs copy. Two kinds of view arrive here:
|
|
714
|
+
//
|
|
715
|
+
// * Library-owned views from `rustbuffer_alloc`. Codegen allocates one,
|
|
716
|
+
// fills it in place, and ships it as an argument — and never frees a
|
|
717
|
+
// lowered argument, while the view's backing `CMutableBuffer` is
|
|
718
|
+
// non-owning (its destructor leaves `data` alone). Such a view
|
|
719
|
+
// carries a capacity hint (stamped by `rustbuffer_alloc` in the
|
|
720
|
+
// wrapper). We *adopt* it: hand the existing allocation to the
|
|
721
|
+
// callee, which frees it. Copying instead would orphan the allocation
|
|
722
|
+
// and leak one whole payload per call.
|
|
723
|
+
// * Ordinary JS-owned arrays, which carry no hint. These are *copied*
|
|
724
|
+
// into a fresh library allocation — they are not ours to give away.
|
|
725
|
+
//
|
|
726
|
+
// On adoption we reset the hint to 0 so a later `rustbuffer_free(view)`
|
|
727
|
+
// is a no-op rather than a double free.
|
|
728
|
+
if (obj.hasProperty(rt, uniffi_jsi::kUbrnRustCapacity)) {
|
|
729
|
+
auto capacity = static_cast<uint64_t>(
|
|
730
|
+
obj.getProperty(rt, uniffi_jsi::kUbrnRustCapacity).asNumber());
|
|
731
|
+
if (capacity == 0) {
|
|
732
|
+
// Hint present but zeroed: the view was already adopted by a previous
|
|
733
|
+
// call and its memory has been freed. Reading it would be a
|
|
734
|
+
// use-after-free, so refuse rather than hand over a dangling pointer.
|
|
735
|
+
throw jsi::JSError(rt, "RustBuffer argument was already consumed by "
|
|
736
|
+
"a previous FFI call");
|
|
737
|
+
}
|
|
738
|
+
auto arrayBuffer =
|
|
739
|
+
obj.getPropertyAsObject(rt, "buffer").getArrayBuffer(rt);
|
|
740
|
+
auto byteOffset =
|
|
741
|
+
static_cast<size_t>(obj.getProperty(rt, "byteOffset").asNumber());
|
|
742
|
+
auto byteLength =
|
|
743
|
+
static_cast<size_t>(obj.getProperty(rt, "byteLength").asNumber());
|
|
744
|
+
obj.setProperty(rt, uniffi_jsi::kUbrnRustCapacity, jsi::Value(0));
|
|
745
|
+
return RustBuffer{
|
|
746
|
+
.capacity = capacity,
|
|
747
|
+
.len = static_cast<uint64_t>(byteLength),
|
|
748
|
+
.data = arrayBuffer.data(rt) + byteOffset,
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
|
|
700
752
|
auto buffer =
|
|
701
753
|
uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt,
|
|
702
754
|
value);
|
|
@@ -705,12 +757,10 @@ template <> struct Bridging<RustBuffer> {
|
|
|
705
757
|
.data = buffer.data(rt),
|
|
706
758
|
};
|
|
707
759
|
|
|
708
|
-
//
|
|
709
|
-
// the
|
|
760
|
+
// No hint: an ordinary JS-owned array. Rust scaffolding copies the bytes
|
|
761
|
+
// to make the RustBuffer; the copy is destroyed when the callee
|
|
762
|
+
// deserializes its arguments.
|
|
710
763
|
auto buf = rustbuffer_from_bytes(bytes);
|
|
711
|
-
// Once it leaves this function, the buffer is immediately passed back
|
|
712
|
-
// into Rust, where it's used to deserialize into the Rust versions of the
|
|
713
|
-
// arguments. At that point, the copy is destroyed.
|
|
714
764
|
return buf;
|
|
715
765
|
} catch (const std::logic_error &e) {
|
|
716
766
|
throw jsi::JSError(rt, e.what());
|
|
@@ -719,26 +769,31 @@ template <> struct Bridging<RustBuffer> {
|
|
|
719
769
|
|
|
720
770
|
static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
|
|
721
771
|
RustBuffer buf) {
|
|
722
|
-
//
|
|
723
|
-
//
|
|
724
|
-
//
|
|
725
|
-
//
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
//
|
|
772
|
+
// View-handoff: hand JS a `Uint8Array` view aliasing the Rust-owned bytes
|
|
773
|
+
// (no boundary copy). The single mandatory copy now happens inside
|
|
774
|
+
// `converter.lift(view)` (string decode, byte-array `set`, field-by-field
|
|
775
|
+
// record reads). The codegen-emitted try/finally calls `rustbuffer_free`
|
|
776
|
+
// on the view after `lift` returns, releasing the Rust allocation.
|
|
777
|
+
//
|
|
778
|
+
// Capacity hint: Rust may return a buffer where `capacity > len`. The
|
|
779
|
+
// view's `byteLength` is `len` (so converters that decode the whole view
|
|
780
|
+
// see only the message bytes), but `rustbuffer_free` needs `capacity` to
|
|
781
|
+
// free correctly. We stash `capacity` on the view via a string-keyed
|
|
782
|
+
// property when it differs from `len`; the JSI `rustbufferFree` host
|
|
783
|
+
// function reads it back and falls back to `byteLength` for views from
|
|
784
|
+
// `rustbufferAlloc(n)` where `byteLength == capacity` already.
|
|
785
|
+
//
|
|
786
|
+
// CMutableBuffer is non-owning here: its destructor leaves `buf.data`
|
|
787
|
+
// alone. Only the codegen-emitted `rustbuffer_free` path frees it.
|
|
730
788
|
auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(
|
|
731
|
-
|
|
732
|
-
auto
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(
|
|
740
|
-
rt, arrayBuffer);
|
|
741
|
-
;
|
|
789
|
+
buf.data, static_cast<size_t>(buf.len));
|
|
790
|
+
auto view =
|
|
791
|
+
uniffi_jsi::arraybufferToUint8Array(rt, jsi::ArrayBuffer(rt, payload));
|
|
792
|
+
if (buf.capacity != static_cast<uint64_t>(buf.len)) {
|
|
793
|
+
view.setProperty(rt, uniffi_jsi::kUbrnRustCapacity,
|
|
794
|
+
jsi::Value(static_cast<double>(buf.capacity)));
|
|
795
|
+
}
|
|
796
|
+
return jsi::Value(rt, view);
|
|
742
797
|
}
|
|
743
798
|
};
|
|
744
799
|
|
|
@@ -763,8 +818,22 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
763
818
|
const jsi::Value &jsStatus) {
|
|
764
819
|
auto statusObject = jsStatus.asObject(rt);
|
|
765
820
|
if (status.error_buf.data != nullptr) {
|
|
766
|
-
|
|
767
|
-
|
|
821
|
+
// The error path is NOT wrapped in the codegen-emitted try/finally that
|
|
822
|
+
// covers normal returns: `errorBuf` is read by the runtime's call-status
|
|
823
|
+
// dispatcher (rust-call.ts) which throws straight to the user without
|
|
824
|
+
// ever calling `rustbuffer_free`. Switching this site to view-handoff
|
|
825
|
+
// would leak the Rust allocation, so we keep the copy semantics here:
|
|
826
|
+
// copy the bytes into a JS-owned ArrayBuffer and free the Rust buffer
|
|
827
|
+
// immediately. The errorBuf is small (a serialized error variant) and
|
|
828
|
+
// only allocated on the cold error path, so the boundary copy is cheap.
|
|
829
|
+
auto len = static_cast<size_t>(status.error_buf.len);
|
|
830
|
+
uint8_t *bytes = new uint8_t[len];
|
|
831
|
+
std::memcpy(bytes, status.error_buf.data, len);
|
|
832
|
+
auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(bytes, len);
|
|
833
|
+
auto view = uniffi_jsi::arraybufferToUint8Array(
|
|
834
|
+
rt, jsi::ArrayBuffer(rt, payload));
|
|
835
|
+
statusObject.setProperty(rt, "errorBuf", view);
|
|
836
|
+
Bridging<RustBuffer>::rustbuffer_free(status.error_buf);
|
|
768
837
|
}
|
|
769
838
|
if (status.code != UNIFFI_CALL_STATUS_OK) {
|
|
770
839
|
auto code =
|
|
@@ -1362,9 +1431,9 @@ template <> struct Bridging<UniffiForeignFutureResultU8> {
|
|
|
1362
1431
|
|
|
1363
1432
|
// Create the vtable from the js callbacks.
|
|
1364
1433
|
rsObject.return_value = uniffi_jsi::Bridging<uint8_t>::fromJs(
|
|
1365
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1434
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1366
1435
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1367
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1436
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1368
1437
|
|
|
1369
1438
|
return rsObject;
|
|
1370
1439
|
}
|
|
@@ -1427,9 +1496,9 @@ template <> struct Bridging<UniffiForeignFutureResultI8> {
|
|
|
1427
1496
|
|
|
1428
1497
|
// Create the vtable from the js callbacks.
|
|
1429
1498
|
rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
|
|
1430
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1499
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1431
1500
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1432
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1501
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1433
1502
|
|
|
1434
1503
|
return rsObject;
|
|
1435
1504
|
}
|
|
@@ -1492,9 +1561,9 @@ template <> struct Bridging<UniffiForeignFutureResultU16> {
|
|
|
1492
1561
|
|
|
1493
1562
|
// Create the vtable from the js callbacks.
|
|
1494
1563
|
rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
|
|
1495
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1564
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1496
1565
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1497
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1566
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1498
1567
|
|
|
1499
1568
|
return rsObject;
|
|
1500
1569
|
}
|
|
@@ -1558,9 +1627,9 @@ template <> struct Bridging<UniffiForeignFutureResultI16> {
|
|
|
1558
1627
|
|
|
1559
1628
|
// Create the vtable from the js callbacks.
|
|
1560
1629
|
rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
|
|
1561
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1630
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1562
1631
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1563
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1632
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1564
1633
|
|
|
1565
1634
|
return rsObject;
|
|
1566
1635
|
}
|
|
@@ -1624,9 +1693,9 @@ template <> struct Bridging<UniffiForeignFutureResultU32> {
|
|
|
1624
1693
|
|
|
1625
1694
|
// Create the vtable from the js callbacks.
|
|
1626
1695
|
rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
|
|
1627
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1696
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1628
1697
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1629
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1698
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1630
1699
|
|
|
1631
1700
|
return rsObject;
|
|
1632
1701
|
}
|
|
@@ -1690,9 +1759,9 @@ template <> struct Bridging<UniffiForeignFutureResultI32> {
|
|
|
1690
1759
|
|
|
1691
1760
|
// Create the vtable from the js callbacks.
|
|
1692
1761
|
rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
|
|
1693
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1762
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1694
1763
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1695
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1764
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1696
1765
|
|
|
1697
1766
|
return rsObject;
|
|
1698
1767
|
}
|
|
@@ -1756,9 +1825,9 @@ template <> struct Bridging<UniffiForeignFutureResultU64> {
|
|
|
1756
1825
|
|
|
1757
1826
|
// Create the vtable from the js callbacks.
|
|
1758
1827
|
rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
|
|
1759
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1828
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1760
1829
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1761
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1830
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1762
1831
|
|
|
1763
1832
|
return rsObject;
|
|
1764
1833
|
}
|
|
@@ -1822,9 +1891,9 @@ template <> struct Bridging<UniffiForeignFutureResultI64> {
|
|
|
1822
1891
|
|
|
1823
1892
|
// Create the vtable from the js callbacks.
|
|
1824
1893
|
rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
|
|
1825
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1894
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1826
1895
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1827
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1896
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1828
1897
|
|
|
1829
1898
|
return rsObject;
|
|
1830
1899
|
}
|
|
@@ -1888,9 +1957,9 @@ template <> struct Bridging<UniffiForeignFutureResultF32> {
|
|
|
1888
1957
|
|
|
1889
1958
|
// Create the vtable from the js callbacks.
|
|
1890
1959
|
rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
|
|
1891
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1960
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1892
1961
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1893
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
1962
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1894
1963
|
|
|
1895
1964
|
return rsObject;
|
|
1896
1965
|
}
|
|
@@ -1954,9 +2023,9 @@ template <> struct Bridging<UniffiForeignFutureResultF64> {
|
|
|
1954
2023
|
|
|
1955
2024
|
// Create the vtable from the js callbacks.
|
|
1956
2025
|
rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
|
|
1957
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2026
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
1958
2027
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
1959
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2028
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
1960
2029
|
|
|
1961
2030
|
return rsObject;
|
|
1962
2031
|
}
|
|
@@ -2020,9 +2089,9 @@ template <> struct Bridging<UniffiForeignFutureResultRustBuffer> {
|
|
|
2020
2089
|
|
|
2021
2090
|
// Create the vtable from the js callbacks.
|
|
2022
2091
|
rsObject.return_value = uniffi::nobodywho::Bridging<RustBuffer>::fromJs(
|
|
2023
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2092
|
+
rt, callInvoker, jsObject.getProperty(rt, "return_value"));
|
|
2024
2093
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
2025
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2094
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
2026
2095
|
|
|
2027
2096
|
return rsObject;
|
|
2028
2097
|
}
|
|
@@ -2088,7 +2157,7 @@ template <> struct Bridging<UniffiForeignFutureResultVoid> {
|
|
|
2088
2157
|
|
|
2089
2158
|
// Create the vtable from the js callbacks.
|
|
2090
2159
|
rsObject.call_status = uniffi::nobodywho::Bridging<RustCallStatus>::fromJs(
|
|
2091
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2160
|
+
rt, callInvoker, jsObject.getProperty(rt, "call_status"));
|
|
2092
2161
|
|
|
2093
2162
|
return rsObject;
|
|
2094
2163
|
}
|
|
@@ -2421,17 +2490,17 @@ struct Bridging<UniffiVTableCallbackInterfaceRustDownloadProgressCallback> {
|
|
|
2421
2490
|
vtablecallbackinterfacerustdownloadprogresscallback::
|
|
2422
2491
|
vtablecallbackinterfacerustdownloadprogresscallback::free::
|
|
2423
2492
|
makeCallbackFunction(rt, callInvoker,
|
|
2424
|
-
jsObject.getProperty(rt, "
|
|
2493
|
+
jsObject.getProperty(rt, "uniffi_free"));
|
|
2425
2494
|
rsObject.uniffi_clone = uniffi::nobodywho::cb::callbackinterfaceclone::
|
|
2426
2495
|
vtablecallbackinterfacerustdownloadprogresscallback::
|
|
2427
2496
|
makeCallbackFunction(rt, callInvoker,
|
|
2428
|
-
jsObject.getProperty(rt, "
|
|
2497
|
+
jsObject.getProperty(rt, "uniffi_clone"));
|
|
2429
2498
|
rsObject.on_download_progress = uniffi::nobodywho::cb::
|
|
2430
2499
|
callbackinterfacerustdownloadprogresscallbackmethod0::
|
|
2431
2500
|
vtablecallbackinterfacerustdownloadprogresscallback::
|
|
2432
2501
|
makeCallbackFunction(
|
|
2433
2502
|
rt, callInvoker,
|
|
2434
|
-
jsObject.getProperty(rt, "
|
|
2503
|
+
jsObject.getProperty(rt, "on_download_progress"));
|
|
2435
2504
|
|
|
2436
2505
|
return rsObject;
|
|
2437
2506
|
}
|
|
@@ -2726,10 +2795,10 @@ template <> struct Bridging<UniffiVTableCallbackInterfaceRustToolCallback> {
|
|
|
2726
2795
|
rsObject.uniffi_free =
|
|
2727
2796
|
uniffi::nobodywho::st::vtablecallbackinterfacerusttoolcallback::
|
|
2728
2797
|
vtablecallbackinterfacerusttoolcallback::free::makeCallbackFunction(
|
|
2729
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2798
|
+
rt, callInvoker, jsObject.getProperty(rt, "uniffi_free"));
|
|
2730
2799
|
rsObject.uniffi_clone = uniffi::nobodywho::cb::callbackinterfaceclone::
|
|
2731
2800
|
vtablecallbackinterfacerusttoolcallback::makeCallbackFunction(
|
|
2732
|
-
rt, callInvoker, jsObject.getProperty(rt, "
|
|
2801
|
+
rt, callInvoker, jsObject.getProperty(rt, "uniffi_clone"));
|
|
2733
2802
|
rsObject.call =
|
|
2734
2803
|
uniffi::nobodywho::cb::callbackinterfacerusttoolcallbackmethod0::
|
|
2735
2804
|
vtablecallbackinterfacerusttoolcallback::makeCallbackFunction(
|
|
@@ -2776,28 +2845,40 @@ NativeNobodywho::NativeNobodywho(
|
|
|
2776
2845
|
return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
2777
2846
|
rt, thisVal, args, count);
|
|
2778
2847
|
});
|
|
2779
|
-
props["
|
|
2848
|
+
props["ubrn_uniffi_internal_fn_func_ffi__string_to_buffer"] =
|
|
2780
2849
|
jsi::Function::createFromHostFunction(
|
|
2781
2850
|
rt,
|
|
2782
2851
|
jsi::PropNameID::forAscii(
|
|
2783
|
-
rt, "
|
|
2852
|
+
rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_buffer"),
|
|
2784
2853
|
1,
|
|
2785
2854
|
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
2786
2855
|
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
2787
|
-
return this->
|
|
2856
|
+
return this->cpp_uniffi_internal_fn_func_ffi__string_to_buffer(
|
|
2788
2857
|
rt, thisVal, args, count);
|
|
2789
2858
|
});
|
|
2790
|
-
props["
|
|
2859
|
+
props["ubrn_uniffi_internal_fn_func_ffi__string_from_buffer"] =
|
|
2791
2860
|
jsi::Function::createFromHostFunction(
|
|
2792
2861
|
rt,
|
|
2793
2862
|
jsi::PropNameID::forAscii(
|
|
2794
|
-
rt, "
|
|
2863
|
+
rt, "ubrn_uniffi_internal_fn_func_ffi__string_from_buffer"),
|
|
2795
2864
|
1,
|
|
2796
2865
|
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
2797
2866
|
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
2798
|
-
return this->
|
|
2867
|
+
return this->cpp_uniffi_internal_fn_func_ffi__string_from_buffer(
|
|
2799
2868
|
rt, thisVal, args, count);
|
|
2800
2869
|
});
|
|
2870
|
+
props["ubrn_uniffi_internal_fn_func_ffi__read_string_from_buffer"] =
|
|
2871
|
+
jsi::Function::createFromHostFunction(
|
|
2872
|
+
rt,
|
|
2873
|
+
jsi::PropNameID::forAscii(
|
|
2874
|
+
rt, "ubrn_uniffi_internal_fn_func_ffi__read_string_from_buffer"),
|
|
2875
|
+
3,
|
|
2876
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
2877
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
2878
|
+
return this
|
|
2879
|
+
->cpp_uniffi_internal_fn_func_ffi__read_string_from_buffer(
|
|
2880
|
+
rt, thisVal, args, count);
|
|
2881
|
+
});
|
|
2801
2882
|
props["ubrn_uniffi_nobodywho_uniffi_fn_clone_rustchat"] =
|
|
2802
2883
|
jsi::Function::createFromHostFunction(
|
|
2803
2884
|
rt,
|
|
@@ -3144,6 +3225,53 @@ NativeNobodywho::NativeNobodywho(
|
|
|
3144
3225
|
->cpp_uniffi_nobodywho_uniffi_fn_method_rustcrossencoder_rank_and_sort_json(
|
|
3145
3226
|
rt, thisVal, args, count);
|
|
3146
3227
|
});
|
|
3228
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_clone_rustdecision"] =
|
|
3229
|
+
jsi::Function::createFromHostFunction(
|
|
3230
|
+
rt,
|
|
3231
|
+
jsi::PropNameID::forAscii(
|
|
3232
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_clone_rustdecision"),
|
|
3233
|
+
1,
|
|
3234
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3235
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3236
|
+
return this->cpp_uniffi_nobodywho_uniffi_fn_clone_rustdecision(
|
|
3237
|
+
rt, thisVal, args, count);
|
|
3238
|
+
});
|
|
3239
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_free_rustdecision"] =
|
|
3240
|
+
jsi::Function::createFromHostFunction(
|
|
3241
|
+
rt,
|
|
3242
|
+
jsi::PropNameID::forAscii(
|
|
3243
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_free_rustdecision"),
|
|
3244
|
+
1,
|
|
3245
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3246
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3247
|
+
return this->cpp_uniffi_nobodywho_uniffi_fn_free_rustdecision(
|
|
3248
|
+
rt, thisVal, args, count);
|
|
3249
|
+
});
|
|
3250
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustdecision_new"] =
|
|
3251
|
+
jsi::Function::createFromHostFunction(
|
|
3252
|
+
rt,
|
|
3253
|
+
jsi::PropNameID::forAscii(
|
|
3254
|
+
rt,
|
|
3255
|
+
"ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustdecision_new"),
|
|
3256
|
+
2,
|
|
3257
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3258
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3259
|
+
return this
|
|
3260
|
+
->cpp_uniffi_nobodywho_uniffi_fn_constructor_rustdecision_new(
|
|
3261
|
+
rt, thisVal, args, count);
|
|
3262
|
+
});
|
|
3263
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_method_rustdecision_decide"] =
|
|
3264
|
+
jsi::Function::createFromHostFunction(
|
|
3265
|
+
rt,
|
|
3266
|
+
jsi::PropNameID::forAscii(
|
|
3267
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_method_rustdecision_decide"),
|
|
3268
|
+
3,
|
|
3269
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3270
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3271
|
+
return this
|
|
3272
|
+
->cpp_uniffi_nobodywho_uniffi_fn_method_rustdecision_decide(
|
|
3273
|
+
rt, thisVal, args, count);
|
|
3274
|
+
});
|
|
3147
3275
|
props["ubrn_uniffi_nobodywho_uniffi_fn_clone_rustencoder"] =
|
|
3148
3276
|
jsi::Function::createFromHostFunction(
|
|
3149
3277
|
rt,
|
|
@@ -5189,6 +5317,18 @@ NativeNobodywho::NativeNobodywho(
|
|
|
5189
5317
|
->cpp_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank_and_sort_json(
|
|
5190
5318
|
rt, thisVal, args, count);
|
|
5191
5319
|
});
|
|
5320
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_method_rustdecision_decide"] =
|
|
5321
|
+
jsi::Function::createFromHostFunction(
|
|
5322
|
+
rt,
|
|
5323
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_nobodywho_uniffi_checksum_"
|
|
5324
|
+
"method_rustdecision_decide"),
|
|
5325
|
+
0,
|
|
5326
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
5327
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5328
|
+
return this
|
|
5329
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_method_rustdecision_decide(
|
|
5330
|
+
rt, thisVal, args, count);
|
|
5331
|
+
});
|
|
5192
5332
|
props["ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode"] =
|
|
5193
5333
|
jsi::Function::createFromHostFunction(
|
|
5194
5334
|
rt,
|
|
@@ -5692,6 +5832,18 @@ NativeNobodywho::NativeNobodywho(
|
|
|
5692
5832
|
->cpp_uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new(
|
|
5693
5833
|
rt, thisVal, args, count);
|
|
5694
5834
|
});
|
|
5835
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustdecision_new"] =
|
|
5836
|
+
jsi::Function::createFromHostFunction(
|
|
5837
|
+
rt,
|
|
5838
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_nobodywho_uniffi_checksum_"
|
|
5839
|
+
"constructor_rustdecision_new"),
|
|
5840
|
+
0,
|
|
5841
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
5842
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5843
|
+
return this
|
|
5844
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_constructor_rustdecision_new(
|
|
5845
|
+
rt, thisVal, args, count);
|
|
5846
|
+
});
|
|
5695
5847
|
props["ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new"] =
|
|
5696
5848
|
jsi::Function::createFromHostFunction(
|
|
5697
5849
|
rt,
|
|
@@ -5851,6 +6003,19 @@ NativeNobodywho::NativeNobodywho(
|
|
|
5851
6003
|
->cpp_uniffi_internal_fn_method_rustcrossencoder_ffi__bless_pointer(
|
|
5852
6004
|
rt, thisVal, args, count);
|
|
5853
6005
|
});
|
|
6006
|
+
props["ubrn_uniffi_internal_fn_method_rustdecision_ffi__bless_pointer"] =
|
|
6007
|
+
jsi::Function::createFromHostFunction(
|
|
6008
|
+
rt,
|
|
6009
|
+
jsi::PropNameID::forAscii(
|
|
6010
|
+
rt,
|
|
6011
|
+
"ubrn_uniffi_internal_fn_method_rustdecision_ffi__bless_pointer"),
|
|
6012
|
+
1,
|
|
6013
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
6014
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
6015
|
+
return this
|
|
6016
|
+
->cpp_uniffi_internal_fn_method_rustdecision_ffi__bless_pointer(
|
|
6017
|
+
rt, thisVal, args, count);
|
|
6018
|
+
});
|
|
5854
6019
|
props["ubrn_uniffi_internal_fn_method_rustencoder_ffi__bless_pointer"] =
|
|
5855
6020
|
jsi::Function::createFromHostFunction(
|
|
5856
6021
|
rt,
|
|
@@ -5975,6 +6140,102 @@ NativeNobodywho::NativeNobodywho(
|
|
|
5975
6140
|
->cpp_uniffi_internal_fn_method_samplerconfig_ffi__bless_pointer(
|
|
5976
6141
|
rt, thisVal, args, count);
|
|
5977
6142
|
});
|
|
6143
|
+
|
|
6144
|
+
// `rustbuffer_alloc(n)` -> Uint8Array view over Rust-owned memory of capacity
|
|
6145
|
+
// `n`. `rustbuffer_free(view)` -> hands the underlying (ptr, capacity) back
|
|
6146
|
+
// to the crate's `rustbuffer_free`. Together they let JS allocate buffers
|
|
6147
|
+
// that the codegen-emitted lowering path can fill in place and ship to Rust
|
|
6148
|
+
// without copying.
|
|
6149
|
+
props["rustbuffer_alloc"] = jsi::Function::createFromHostFunction(
|
|
6150
|
+
rt, jsi::PropNameID::forAscii(rt, "rustbuffer_alloc"), 1,
|
|
6151
|
+
[](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6152
|
+
size_t count) -> jsi::Value {
|
|
6153
|
+
if (count < 1 || !args[0].isNumber()) {
|
|
6154
|
+
throw jsi::JSError(rt, "rustbuffer_alloc expected a number argument");
|
|
6155
|
+
}
|
|
6156
|
+
double size = args[0].asNumber();
|
|
6157
|
+
if (size < 0) {
|
|
6158
|
+
throw jsi::JSError(rt, "rustbuffer_alloc: size must be non-negative");
|
|
6159
|
+
}
|
|
6160
|
+
if (size > INT32_MAX) {
|
|
6161
|
+
throw jsi::JSError(rt, "rustbuffer_alloc: size exceeds INT32_MAX");
|
|
6162
|
+
}
|
|
6163
|
+
auto rb = uniffi::nobodywho::Bridging<RustBuffer>::rustbuffer_alloc(
|
|
6164
|
+
static_cast<int32_t>(size));
|
|
6165
|
+
if (rb.data == nullptr) {
|
|
6166
|
+
throw jsi::JSError(rt,
|
|
6167
|
+
"rustbuffer_alloc failed: alloc returned null");
|
|
6168
|
+
}
|
|
6169
|
+
// Non-owning view over Rust-allocated memory; CMutableBuffer's
|
|
6170
|
+
// destructor is the default and does not free `rb.data`. The allocation
|
|
6171
|
+
// is released either by an explicit `rustbuffer_free(view)` or by being
|
|
6172
|
+
// adopted when the view is lowered as an FFI argument.
|
|
6173
|
+
auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(
|
|
6174
|
+
rb.data, static_cast<size_t>(rb.capacity));
|
|
6175
|
+
// Wrap as Uint8Array so JS can index/assign bytes directly.
|
|
6176
|
+
auto view = uniffi_jsi::arraybufferToUint8Array(
|
|
6177
|
+
rt, jsi::ArrayBuffer(rt, payload));
|
|
6178
|
+
// Stamp the capacity so the argument-lowering path
|
|
6179
|
+
// (`Bridging<RustBuffer>::fromJs`) recognises this view as
|
|
6180
|
+
// library-owned and adopts the allocation instead of copying it.
|
|
6181
|
+
// Without the stamp, a lowered argument is copied and this
|
|
6182
|
+
// allocation is orphaned — one leaked payload per call.
|
|
6183
|
+
if (rb.capacity > 0) {
|
|
6184
|
+
view.setProperty(rt, uniffi_jsi::kUbrnRustCapacity,
|
|
6185
|
+
jsi::Value(static_cast<double>(rb.capacity)));
|
|
6186
|
+
}
|
|
6187
|
+
return jsi::Value(rt, view);
|
|
6188
|
+
});
|
|
6189
|
+
|
|
6190
|
+
props["rustbuffer_free"] = jsi::Function::createFromHostFunction(
|
|
6191
|
+
rt, jsi::PropNameID::forAscii(rt, "rustbuffer_free"), 1,
|
|
6192
|
+
[](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6193
|
+
size_t count) -> jsi::Value {
|
|
6194
|
+
if (count < 1 || !args[0].isObject()) {
|
|
6195
|
+
throw jsi::JSError(rt,
|
|
6196
|
+
"rustbuffer_free expected a Uint8Array argument");
|
|
6197
|
+
}
|
|
6198
|
+
auto view = args[0].asObject(rt);
|
|
6199
|
+
auto byteLength =
|
|
6200
|
+
static_cast<size_t>(view.getProperty(rt, "byteLength").asNumber());
|
|
6201
|
+
// Empty views were never allocated by `rustbuffer_alloc`; nothing
|
|
6202
|
+
// to free. Bail out before reading buffer/byteOffset/capacity to
|
|
6203
|
+
// skip three JSI property traversals on the empty path.
|
|
6204
|
+
if (byteLength == 0) {
|
|
6205
|
+
return jsi::Value::undefined();
|
|
6206
|
+
}
|
|
6207
|
+
// Capacity resolution:
|
|
6208
|
+
// * For a view from `rustbuffer_alloc(n)`, `byteLength == n ==
|
|
6209
|
+
// capacity`,
|
|
6210
|
+
// and no `__ubrnRustCapacity` hint was set.
|
|
6211
|
+
// * For a view from a lift-handoff, the codegen-emitted
|
|
6212
|
+
// `Bridging<RustBuffer>::toJs` set `byteLength = len` and stashed
|
|
6213
|
+
// the original `capacity` on `__ubrnRustCapacity` whenever
|
|
6214
|
+
// `capacity != len`.
|
|
6215
|
+
// So: prefer the hint, fall back to byteLength.
|
|
6216
|
+
size_t capacity = byteLength;
|
|
6217
|
+
if (view.hasProperty(rt, uniffi_jsi::kUbrnRustCapacity)) {
|
|
6218
|
+
capacity = static_cast<size_t>(
|
|
6219
|
+
view.getProperty(rt, uniffi_jsi::kUbrnRustCapacity).asNumber());
|
|
6220
|
+
}
|
|
6221
|
+
// A zero capacity marks a view already adopted as an FFI argument
|
|
6222
|
+
// (its hint was reset to 0) and freed by the callee. Freeing again
|
|
6223
|
+
// would be a double free, so this is a no-op.
|
|
6224
|
+
if (capacity == 0) {
|
|
6225
|
+
return jsi::Value::undefined();
|
|
6226
|
+
}
|
|
6227
|
+
auto buffer = view.getPropertyAsObject(rt, "buffer").getArrayBuffer(rt);
|
|
6228
|
+
auto byteOffset =
|
|
6229
|
+
static_cast<size_t>(view.getProperty(rt, "byteOffset").asNumber());
|
|
6230
|
+
// Honour byteOffset for safety (defensive; currently always 0).
|
|
6231
|
+
RustBuffer rb{
|
|
6232
|
+
.capacity = static_cast<uint64_t>(capacity),
|
|
6233
|
+
.len = 0,
|
|
6234
|
+
.data = buffer.data(rt) + byteOffset,
|
|
6235
|
+
};
|
|
6236
|
+
uniffi::nobodywho::Bridging<RustBuffer>::rustbuffer_free(rb);
|
|
6237
|
+
return jsi::Value::undefined();
|
|
6238
|
+
});
|
|
5978
6239
|
}
|
|
5979
6240
|
|
|
5980
6241
|
void NativeNobodywho::registerModule(
|
|
@@ -5993,7 +6254,7 @@ void NativeNobodywho::unregisterModule(jsi::Runtime &rt) {
|
|
|
5993
6254
|
jsi::Value NativeNobodywho::get(jsi::Runtime &rt, const jsi::PropNameID &name) {
|
|
5994
6255
|
try {
|
|
5995
6256
|
return jsi::Value(rt, props.at(name.utf8(rt)));
|
|
5996
|
-
} catch (std::out_of_range &
|
|
6257
|
+
} catch (std::out_of_range &) {
|
|
5997
6258
|
return jsi::Value::undefined();
|
|
5998
6259
|
}
|
|
5999
6260
|
}
|
|
@@ -6040,18 +6301,24 @@ NativeNobodywho::cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
|
6040
6301
|
return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
|
|
6041
6302
|
}
|
|
6042
6303
|
|
|
6043
|
-
jsi::Value
|
|
6044
|
-
NativeNobodywho::cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
|
6304
|
+
jsi::Value NativeNobodywho::cpp_uniffi_internal_fn_func_ffi__string_to_buffer(
|
|
6045
6305
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6046
6306
|
size_t count) {
|
|
6047
|
-
return uniffi_jsi::Bridging<std::string>::
|
|
6307
|
+
return uniffi_jsi::Bridging<std::string>::string_to_buffer(rt, args[0]);
|
|
6308
|
+
}
|
|
6309
|
+
|
|
6310
|
+
jsi::Value NativeNobodywho::cpp_uniffi_internal_fn_func_ffi__string_from_buffer(
|
|
6311
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6312
|
+
size_t count) {
|
|
6313
|
+
return uniffi_jsi::Bridging<std::string>::string_from_buffer(rt, args[0]);
|
|
6048
6314
|
}
|
|
6049
6315
|
|
|
6050
6316
|
jsi::Value
|
|
6051
|
-
NativeNobodywho::
|
|
6317
|
+
NativeNobodywho::cpp_uniffi_internal_fn_func_ffi__read_string_from_buffer(
|
|
6052
6318
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6053
6319
|
size_t count) {
|
|
6054
|
-
return uniffi_jsi::Bridging<std::string>::
|
|
6320
|
+
return uniffi_jsi::Bridging<std::string>::read_string_from_buffer(
|
|
6321
|
+
rt, args[0], args[1], args[2]);
|
|
6055
6322
|
}
|
|
6056
6323
|
jsi::Value
|
|
6057
6324
|
NativeNobodywho::cpp_uniffi_internal_fn_method_rustchat_ffi__bless_pointer(
|
|
@@ -6084,6 +6351,21 @@ jsi::Value NativeNobodywho::
|
|
|
6084
6351
|
return jsi::Value(rt, obj);
|
|
6085
6352
|
}
|
|
6086
6353
|
jsi::Value
|
|
6354
|
+
NativeNobodywho::cpp_uniffi_internal_fn_method_rustdecision_ffi__bless_pointer(
|
|
6355
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6356
|
+
size_t count) {
|
|
6357
|
+
auto pointer =
|
|
6358
|
+
uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
|
|
6359
|
+
auto static destructor = [](uint64_t p) {
|
|
6360
|
+
RustCallStatus status = {0};
|
|
6361
|
+
uniffi_nobodywho_uniffi_fn_free_rustdecision(p, &status);
|
|
6362
|
+
};
|
|
6363
|
+
auto ptrObj =
|
|
6364
|
+
std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
|
|
6365
|
+
auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
|
|
6366
|
+
return jsi::Value(rt, obj);
|
|
6367
|
+
}
|
|
6368
|
+
jsi::Value
|
|
6087
6369
|
NativeNobodywho::cpp_uniffi_internal_fn_method_rustencoder_ffi__bless_pointer(
|
|
6088
6370
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6089
6371
|
size_t count) {
|
|
@@ -6646,6 +6928,66 @@ jsi::Value NativeNobodywho::
|
|
|
6646
6928
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6647
6929
|
value);
|
|
6648
6930
|
}
|
|
6931
|
+
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_clone_rustdecision(
|
|
6932
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6933
|
+
size_t count) {
|
|
6934
|
+
RustCallStatus status =
|
|
6935
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6936
|
+
auto value = uniffi_nobodywho_uniffi_fn_clone_rustdecision(
|
|
6937
|
+
uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
|
|
6938
|
+
args[0]),
|
|
6939
|
+
&status);
|
|
6940
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6941
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6942
|
+
|
|
6943
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6944
|
+
value);
|
|
6945
|
+
}
|
|
6946
|
+
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_free_rustdecision(
|
|
6947
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6948
|
+
size_t count) {
|
|
6949
|
+
RustCallStatus status =
|
|
6950
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6951
|
+
uniffi_nobodywho_uniffi_fn_free_rustdecision(
|
|
6952
|
+
uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
|
|
6953
|
+
args[0]),
|
|
6954
|
+
&status);
|
|
6955
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6956
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6957
|
+
|
|
6958
|
+
return jsi::Value::undefined();
|
|
6959
|
+
}
|
|
6960
|
+
jsi::Value
|
|
6961
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_constructor_rustdecision_new(
|
|
6962
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6963
|
+
size_t count) {
|
|
6964
|
+
RustCallStatus status =
|
|
6965
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6966
|
+
auto value = uniffi_nobodywho_uniffi_fn_constructor_rustdecision_new(
|
|
6967
|
+
uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
|
|
6968
|
+
args[0]),
|
|
6969
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
|
|
6970
|
+
&status);
|
|
6971
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6972
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6973
|
+
|
|
6974
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6975
|
+
value);
|
|
6976
|
+
}
|
|
6977
|
+
jsi::Value
|
|
6978
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_method_rustdecision_decide(
|
|
6979
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6980
|
+
size_t count) {
|
|
6981
|
+
auto value = uniffi_nobodywho_uniffi_fn_method_rustdecision_decide(
|
|
6982
|
+
uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
|
|
6983
|
+
args[0]),
|
|
6984
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
|
|
6985
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
6986
|
+
args[2]));
|
|
6987
|
+
|
|
6988
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6989
|
+
value);
|
|
6990
|
+
}
|
|
6649
6991
|
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_clone_rustencoder(
|
|
6650
6992
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6651
6993
|
size_t count) {
|
|
@@ -8895,6 +9237,14 @@ jsi::Value NativeNobodywho::
|
|
|
8895
9237
|
|
|
8896
9238
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8897
9239
|
}
|
|
9240
|
+
jsi::Value NativeNobodywho::
|
|
9241
|
+
cpp_uniffi_nobodywho_uniffi_checksum_method_rustdecision_decide(
|
|
9242
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
9243
|
+
size_t count) {
|
|
9244
|
+
auto value = uniffi_nobodywho_uniffi_checksum_method_rustdecision_decide();
|
|
9245
|
+
|
|
9246
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
9247
|
+
}
|
|
8898
9248
|
jsi::Value
|
|
8899
9249
|
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode(
|
|
8900
9250
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -9250,6 +9600,14 @@ jsi::Value NativeNobodywho::
|
|
|
9250
9600
|
|
|
9251
9601
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
9252
9602
|
}
|
|
9603
|
+
jsi::Value NativeNobodywho::
|
|
9604
|
+
cpp_uniffi_nobodywho_uniffi_checksum_constructor_rustdecision_new(
|
|
9605
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
9606
|
+
size_t count) {
|
|
9607
|
+
auto value = uniffi_nobodywho_uniffi_checksum_constructor_rustdecision_new();
|
|
9608
|
+
|
|
9609
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
9610
|
+
}
|
|
9253
9611
|
jsi::Value NativeNobodywho::
|
|
9254
9612
|
cpp_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new(
|
|
9255
9613
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|