@rusaint/react-native 0.10.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +15 -0
- package/android/CMakeLists.txt +78 -0
- package/android/build.gradle +143 -0
- package/android/cpp-adapter.cpp +63 -0
- package/android/generated/java/dev/eatsteak/rusaint/reactnative/NativeReactNativeSpec.java +41 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNReactNativeSpec-generated.cpp +38 -0
- package/android/generated/jni/RNReactNativeSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNReactNativeSpec/RNReactNativeSpecJSI-generated.cpp +32 -0
- package/android/generated/jni/react/renderer/components/RNReactNativeSpec/RNReactNativeSpecJSI.h +80 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/dev/eatsteak/rusaint/reactnative/ReactNativeModule.kt +43 -0
- package/android/src/main/java/dev/eatsteak/rusaint/reactnative/ReactNativePackage.kt +34 -0
- package/android/src/main/jniLibs/arm64-v8a/librusaint_ffi.a +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/librusaint_ffi.a +0 -0
- package/android/src/main/jniLibs/x86/librusaint_ffi.a +0 -0
- package/android/src/main/jniLibs/x86_64/librusaint_ffi.a +0 -0
- package/build/RusaintReactNativeFramework.xcframework/Info.plist +43 -0
- package/build/RusaintReactNativeFramework.xcframework/ios-arm64/librusaint_ffi.a +0 -0
- package/build/RusaintReactNativeFramework.xcframework/ios-arm64-simulator/librusaint_ffi.a +0 -0
- package/cpp/generated/rusaint.cpp +2485 -0
- package/cpp/generated/rusaint.hpp +168 -0
- package/cpp/generated/rusaint_ffi.cpp +7397 -0
- package/cpp/generated/rusaint_ffi.hpp +873 -0
- package/cpp/rusaint-react-native.cpp +18 -0
- package/cpp/rusaint-react-native.h +15 -0
- package/ios/ReactNative.h +16 -0
- package/ios/ReactNative.mm +66 -0
- package/ios/generated/RNReactNativeSpec/RNReactNativeSpec-generated.mm +46 -0
- package/ios/generated/RNReactNativeSpec/RNReactNativeSpec.h +63 -0
- package/ios/generated/RNReactNativeSpecJSI-generated.cpp +32 -0
- package/ios/generated/RNReactNativeSpecJSI.h +80 -0
- package/lib/commonjs/NativeReactNative.ts +10 -0
- package/lib/commonjs/generated/rusaint-ffi.js +44 -0
- package/lib/commonjs/generated/rusaint-ffi.js.map +1 -0
- package/lib/commonjs/generated/rusaint.js +3232 -0
- package/lib/commonjs/generated/rusaint.js.map +1 -0
- package/lib/commonjs/generated/rusaint_ffi-ffi.js +44 -0
- package/lib/commonjs/generated/rusaint_ffi-ffi.js.map +1 -0
- package/lib/commonjs/generated/rusaint_ffi.js +2493 -0
- package/lib/commonjs/generated/rusaint_ffi.js.map +1 -0
- package/lib/commonjs/index.js +68 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NativeReactNative.ts +10 -0
- package/lib/module/generated/rusaint-ffi.js +43 -0
- package/lib/module/generated/rusaint-ffi.js.map +1 -0
- package/lib/module/generated/rusaint.js +3226 -0
- package/lib/module/generated/rusaint.js.map +1 -0
- package/lib/module/generated/rusaint_ffi-ffi.js +43 -0
- package/lib/module/generated/rusaint_ffi-ffi.js.map +1 -0
- package/lib/module/generated/rusaint_ffi.js +2469 -0
- package/lib/module/generated/rusaint_ffi.js.map +1 -0
- package/lib/module/index.js +40 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeReactNative.d.ts +8 -0
- package/lib/typescript/commonjs/src/NativeReactNative.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/rusaint-ffi.d.ts +109 -0
- package/lib/typescript/commonjs/src/generated/rusaint-ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/rusaint.d.ts +2330 -0
- package/lib/typescript/commonjs/src/generated/rusaint.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/rusaint_ffi-ffi.d.ts +300 -0
- package/lib/typescript/commonjs/src/generated/rusaint_ffi-ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/rusaint_ffi.d.ts +1111 -0
- package/lib/typescript/commonjs/src/generated/rusaint_ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/package.json +185 -0
- package/react-native.config.js +12 -0
- package/rusaint-react-native.podspec +44 -0
- package/src/NativeReactNative.ts +10 -0
- package/src/generated/rusaint-ffi.ts +276 -0
- package/src/generated/rusaint.ts +4867 -0
- package/src/generated/rusaint_ffi-ffi.ts +832 -0
- package/src/generated/rusaint_ffi.ts +5519 -0
- package/src/index.tsx +38 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
#include "rusaint-react-native.h"
|
|
3
|
+
#include "generated/rusaint.hpp"
|
|
4
|
+
#include "generated/rusaint_ffi.hpp"
|
|
5
|
+
|
|
6
|
+
namespace rusaint_reactnative {
|
|
7
|
+
using namespace facebook;
|
|
8
|
+
|
|
9
|
+
uint8_t installRustCrate(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker) {
|
|
10
|
+
NativeRusaint::registerModule(runtime, callInvoker);
|
|
11
|
+
NativeRusaintFfi::registerModule(runtime, callInvoker);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
uint8_t cleanupRustCrate(jsi::Runtime &runtime) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifndef RUSAINT_REACTNATIVE_H
|
|
2
|
+
#define RUSAINT_REACTNATIVE_H
|
|
3
|
+
// Generated by uniffi-bindgen-react-native
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <jsi/jsi.h>
|
|
6
|
+
#include <ReactCommon/CallInvoker.h>
|
|
7
|
+
|
|
8
|
+
namespace rusaint_reactnative {
|
|
9
|
+
using namespace facebook;
|
|
10
|
+
|
|
11
|
+
uint8_t installRustCrate(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker);
|
|
12
|
+
uint8_t cleanupRustCrate(jsi::Runtime &runtime);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#endif /* RUSAINT_REACTNATIVE_H */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
#ifdef __cplusplus
|
|
3
|
+
#import "rusaint-react-native.h"
|
|
4
|
+
#endif
|
|
5
|
+
|
|
6
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
7
|
+
#import "RNReactNativeSpec.h"
|
|
8
|
+
|
|
9
|
+
@interface ReactNative : NSObject <NativeReactNativeSpec>
|
|
10
|
+
#else
|
|
11
|
+
#import <React/RCTBridgeModule.h>
|
|
12
|
+
|
|
13
|
+
@interface ReactNative : NSObject <RCTBridgeModule>
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
#import "ReactNative.h"
|
|
3
|
+
|
|
4
|
+
namespace uniffi_generated {
|
|
5
|
+
using namespace facebook::react;
|
|
6
|
+
/**
|
|
7
|
+
* ObjC++ class for module 'NativeReactNative'
|
|
8
|
+
*/
|
|
9
|
+
class JSI_EXPORT NativeReactNativeSpecJSI : public ObjCTurboModule {
|
|
10
|
+
public:
|
|
11
|
+
NativeReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
12
|
+
std::shared_ptr<CallInvoker> callInvoker;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_ReactNative_installRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
auto& tm = static_cast<NativeReactNativeSpecJSI&>(turboModule);
|
|
17
|
+
auto jsInvoker = tm.callInvoker;
|
|
18
|
+
uint8_t result = rusaint_reactnative::installRustCrate(rt, jsInvoker);
|
|
19
|
+
return facebook::jsi::Value(rt, result);
|
|
20
|
+
}
|
|
21
|
+
static facebook::jsi::Value __hostFunction_ReactNative_cleanupRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
22
|
+
uint8_t result = rusaint_reactnative::cleanupRustCrate(rt);
|
|
23
|
+
return facebook::jsi::Value(rt, result);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
NativeReactNativeSpecJSI::NativeReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
27
|
+
: ObjCTurboModule(params), callInvoker(params.jsInvoker) {
|
|
28
|
+
this->methodMap_["installRustCrate"] = MethodMetadata {1, __hostFunction_ReactNative_installRustCrate};
|
|
29
|
+
this->methodMap_["cleanupRustCrate"] = MethodMetadata {1, __hostFunction_ReactNative_cleanupRustCrate};
|
|
30
|
+
}
|
|
31
|
+
} // namespace uniffi_generated
|
|
32
|
+
|
|
33
|
+
@implementation ReactNative
|
|
34
|
+
RCT_EXPORT_MODULE()
|
|
35
|
+
|
|
36
|
+
// Don't compile this code when we build for the old architecture.
|
|
37
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
38
|
+
|
|
39
|
+
// Automated testing checks rusaint_reactnative
|
|
40
|
+
// by comparing the whole line here.
|
|
41
|
+
/*
|
|
42
|
+
- (NSNumber *)multiply:(double)a b:(double)b {
|
|
43
|
+
NSNumber *result = @(rusaint_reactnative::multiply(a, b));
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
- (NSNumber *)installRustCrate {
|
|
48
|
+
@throw [NSException exceptionWithName:@"UnreachableException"
|
|
49
|
+
reason:@"This method should never be called."
|
|
50
|
+
userInfo:nil];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
- (NSNumber *)cleanupRustCrate {
|
|
54
|
+
@throw [NSException exceptionWithName:@"UnreachableException"
|
|
55
|
+
reason:@"This method should never be called."
|
|
56
|
+
userInfo:nil];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
60
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
61
|
+
{
|
|
62
|
+
return std::make_shared<uniffi_generated::NativeReactNativeSpecJSI>(params);
|
|
63
|
+
}
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
@end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#import "RNReactNativeSpec.h"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@implementation NativeReactNativeSpecBase
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
21
|
+
{
|
|
22
|
+
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
|
|
23
|
+
}
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
namespace facebook::react {
|
|
28
|
+
|
|
29
|
+
static facebook::jsi::Value __hostFunction_NativeReactNativeSpecJSI_installRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
30
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, BooleanKind, "installRustCrate", @selector(installRustCrate), args, count);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static facebook::jsi::Value __hostFunction_NativeReactNativeSpecJSI_cleanupRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
34
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, BooleanKind, "cleanupRustCrate", @selector(cleanupRustCrate), args, count);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
NativeReactNativeSpecJSI::NativeReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
38
|
+
: ObjCTurboModule(params) {
|
|
39
|
+
|
|
40
|
+
methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeReactNativeSpecJSI_installRustCrate};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeReactNativeSpecJSI_cleanupRustCrate};
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of RNReactNativeSpec symbols
|
|
19
|
+
#ifndef RNReactNativeSpec_H
|
|
20
|
+
#define RNReactNativeSpec_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
35
|
+
|
|
36
|
+
@protocol NativeReactNativeSpec <RCTBridgeModule, RCTTurboModule>
|
|
37
|
+
|
|
38
|
+
- (NSNumber *)installRustCrate;
|
|
39
|
+
- (NSNumber *)cleanupRustCrate;
|
|
40
|
+
|
|
41
|
+
@end
|
|
42
|
+
|
|
43
|
+
@interface NativeReactNativeSpecBase : NSObject {
|
|
44
|
+
@protected
|
|
45
|
+
facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
46
|
+
}
|
|
47
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@end
|
|
51
|
+
|
|
52
|
+
namespace facebook::react {
|
|
53
|
+
/**
|
|
54
|
+
* ObjC++ class for module 'NativeReactNative'
|
|
55
|
+
*/
|
|
56
|
+
class JSI_EXPORT NativeReactNativeSpecJSI : public ObjCTurboModule {
|
|
57
|
+
public:
|
|
58
|
+
NativeReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
59
|
+
};
|
|
60
|
+
} // namespace facebook::react
|
|
61
|
+
|
|
62
|
+
NS_ASSUME_NONNULL_END
|
|
63
|
+
#endif // RNReactNativeSpec_H
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNReactNativeSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeReactNativeCxxSpecJSI_installRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeReactNativeCxxSpecJSI *>(&turboModule)->installRustCrate(
|
|
16
|
+
rt
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
static jsi::Value __hostFunction_NativeReactNativeCxxSpecJSI_cleanupRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
20
|
+
return static_cast<NativeReactNativeCxxSpecJSI *>(&turboModule)->cleanupRustCrate(
|
|
21
|
+
rt
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NativeReactNativeCxxSpecJSI::NativeReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
26
|
+
: TurboModule("ReactNative", jsInvoker) {
|
|
27
|
+
methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeReactNativeCxxSpecJSI_installRustCrate};
|
|
28
|
+
methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeReactNativeCxxSpecJSI_cleanupRustCrate};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeReactNativeCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual bool installRustCrate(jsi::Runtime &rt) = 0;
|
|
24
|
+
virtual bool cleanupRustCrate(jsi::Runtime &rt) = 0;
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename T>
|
|
29
|
+
class JSI_EXPORT NativeReactNativeCxxSpec : public TurboModule {
|
|
30
|
+
public:
|
|
31
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
32
|
+
return delegate_.create(rt, propName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
36
|
+
return delegate_.getPropertyNames(runtime);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static constexpr std::string_view kModuleName = "ReactNative";
|
|
40
|
+
|
|
41
|
+
protected:
|
|
42
|
+
NativeReactNativeCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
43
|
+
: TurboModule(std::string{NativeReactNativeCxxSpec::kModuleName}, jsInvoker),
|
|
44
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
class Delegate : public NativeReactNativeCxxSpecJSI {
|
|
49
|
+
public:
|
|
50
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
51
|
+
NativeReactNativeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
bool installRustCrate(jsi::Runtime &rt) override {
|
|
56
|
+
static_assert(
|
|
57
|
+
bridging::getParameterCount(&T::installRustCrate) == 1,
|
|
58
|
+
"Expected installRustCrate(...) to have 1 parameters");
|
|
59
|
+
|
|
60
|
+
return bridging::callFromJs<bool>(
|
|
61
|
+
rt, &T::installRustCrate, jsInvoker_, instance_);
|
|
62
|
+
}
|
|
63
|
+
bool cleanupRustCrate(jsi::Runtime &rt) override {
|
|
64
|
+
static_assert(
|
|
65
|
+
bridging::getParameterCount(&T::cleanupRustCrate) == 1,
|
|
66
|
+
"Expected cleanupRustCrate(...) to have 1 parameters");
|
|
67
|
+
|
|
68
|
+
return bridging::callFromJs<bool>(
|
|
69
|
+
rt, &T::cleanupRustCrate, jsInvoker_, instance_);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
friend class NativeReactNativeCxxSpec;
|
|
74
|
+
T *instance_;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Delegate delegate_;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
installRustCrate(): boolean;
|
|
7
|
+
cleanupRustCrate(): boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('ReactNative');
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
8
|
+
// Trust me, you don't want to mess with it!
|
|
9
|
+
|
|
10
|
+
// Casting globalThis to any allows us to look for `NativeRusaint`
|
|
11
|
+
// if it was added via JSI.
|
|
12
|
+
//
|
|
13
|
+
// We use a getter here rather than simply `globalThis.NativeRusaint` so that
|
|
14
|
+
// if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
|
|
15
|
+
const getter = () => globalThis.NativeRusaint;
|
|
16
|
+
var _default = exports.default = getter; // Structs and function types for calling back into Typescript from Rust.
|
|
17
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
18
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
19
|
+
// We could:
|
|
20
|
+
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
|
21
|
+
// (b) import the generated declaration into the runtime (m a y b e) or…
|
|
22
|
+
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
|
23
|
+
//
|
|
24
|
+
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
|
25
|
+
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
|
26
|
+
//
|
|
27
|
+
// If you see the error:
|
|
28
|
+
// ```
|
|
29
|
+
// Type 'true' is not assignable to type 'false'.(2322)
|
|
30
|
+
// ```
|
|
31
|
+
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
|
32
|
+
// `typescript/src/async-rust-call.ts` will need to be changed.
|
|
33
|
+
//
|
|
34
|
+
// If you see the error:
|
|
35
|
+
// ```
|
|
36
|
+
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
|
37
|
+
// ```
|
|
38
|
+
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
|
39
|
+
// You should not generate this if that is the case.
|
|
40
|
+
//
|
|
41
|
+
// ('You' being the bindings generator maintainer).
|
|
42
|
+
const isRustFutureContinuationCallbackTypeCompatible = true;
|
|
43
|
+
const isUniffiForeignFutureTypeCompatible = true;
|
|
44
|
+
//# sourceMappingURL=rusaint-ffi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getter","globalThis","NativeRusaint","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/rusaint-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAsHA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACrBL,MAAM,EAErB;AAmHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
|