mirror of
https://github.com/EthanShoeDev/fressh.git
synced 2026-01-12 23:02:49 +00:00
add calc getting started to main app
This commit is contained in:
10
packages/react-native-uniffi-russh/src/NativeUniffiRussh.ts
Normal file
10
packages/react-native-uniffi-russh/src/NativeUniffiRussh.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// Generated by uniffi-bindgen-react-native
|
||||
import type { TurboModule } from 'react-native';
|
||||
import { TurboModuleRegistry } from 'react-native';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
installRustCrate(): boolean;
|
||||
cleanupRustCrate(): boolean;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('UniffiRussh');
|
||||
306
packages/react-native-uniffi-russh/src/generated/foobar-ffi.ts
Normal file
306
packages/react-native-uniffi-russh/src/generated/foobar-ffi.ts
Normal file
@@ -0,0 +1,306 @@
|
||||
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
||||
// Trust me, you don't want to mess with it!
|
||||
|
||||
import {
|
||||
type StructuralEquality as UniffiStructuralEquality,
|
||||
type UniffiForeignFuture as RuntimeUniffiForeignFuture,
|
||||
type UniffiRustCallStatus,
|
||||
type UniffiRustArcPtr,
|
||||
type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
|
||||
type UniffiResult,
|
||||
} from 'uniffi-bindgen-react-native';
|
||||
|
||||
interface NativeModuleInterface {
|
||||
ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
||||
string: string,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): number;
|
||||
ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
||||
string: string,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): Uint8Array;
|
||||
ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
|
||||
buffer: Uint8Array,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): string;
|
||||
ubrn_uniffi_foobar_fn_clone_binaryoperator(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_free_binaryoperator(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): void;
|
||||
ubrn_uniffi_foobar_fn_init_callback_vtable_binaryoperator(
|
||||
vtable: UniffiVTableCallbackInterfaceBinaryOperator
|
||||
): void;
|
||||
ubrn_uniffi_foobar_fn_method_binaryoperator_perform(
|
||||
ptr: bigint,
|
||||
lhs: bigint,
|
||||
rhs: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_clone_calculator(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_free_calculator(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): void;
|
||||
ubrn_uniffi_foobar_fn_constructor_calculator_new(
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_method_calculator_calculate(
|
||||
ptr: bigint,
|
||||
op: bigint,
|
||||
lhs: bigint,
|
||||
rhs: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_method_calculator_calculate_more(
|
||||
ptr: bigint,
|
||||
op: bigint,
|
||||
rhs: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_method_calculator_last_result(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): Uint8Array;
|
||||
ubrn_uniffi_foobar_fn_clone_safeaddition(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_free_safeaddition(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): void;
|
||||
ubrn_uniffi_foobar_fn_constructor_safeaddition_new(
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_method_safeaddition_perform(
|
||||
ptr: bigint,
|
||||
lhs: bigint,
|
||||
rhs: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_clone_safedivision(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_free_safedivision(
|
||||
ptr: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): void;
|
||||
ubrn_uniffi_foobar_fn_constructor_safedivision_new(
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_method_safedivision_perform(
|
||||
ptr: bigint,
|
||||
lhs: bigint,
|
||||
rhs: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_func_safe_addition_operator(
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_fn_func_safe_division_operator(
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): bigint;
|
||||
ubrn_uniffi_foobar_checksum_func_safe_addition_operator(): number;
|
||||
ubrn_uniffi_foobar_checksum_func_safe_division_operator(): number;
|
||||
ubrn_uniffi_foobar_checksum_method_binaryoperator_perform(): number;
|
||||
ubrn_uniffi_foobar_checksum_method_calculator_calculate(): number;
|
||||
ubrn_uniffi_foobar_checksum_method_calculator_calculate_more(): number;
|
||||
ubrn_uniffi_foobar_checksum_method_calculator_last_result(): number;
|
||||
ubrn_uniffi_foobar_checksum_method_safeaddition_perform(): number;
|
||||
ubrn_uniffi_foobar_checksum_method_safedivision_perform(): number;
|
||||
ubrn_uniffi_foobar_checksum_constructor_calculator_new(): number;
|
||||
ubrn_uniffi_foobar_checksum_constructor_safeaddition_new(): number;
|
||||
ubrn_uniffi_foobar_checksum_constructor_safedivision_new(): number;
|
||||
ubrn_ffi_foobar_uniffi_contract_version(): number;
|
||||
ubrn_uniffi_internal_fn_method_binaryoperator_ffi__bless_pointer(
|
||||
pointer: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): UniffiRustArcPtr;
|
||||
ubrn_uniffi_internal_fn_method_calculator_ffi__bless_pointer(
|
||||
pointer: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): UniffiRustArcPtr;
|
||||
ubrn_uniffi_internal_fn_method_safeaddition_ffi__bless_pointer(
|
||||
pointer: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): UniffiRustArcPtr;
|
||||
ubrn_uniffi_internal_fn_method_safedivision_ffi__bless_pointer(
|
||||
pointer: bigint,
|
||||
uniffi_out_err: UniffiRustCallStatus
|
||||
): UniffiRustArcPtr;
|
||||
}
|
||||
|
||||
// Casting globalThis to any allows us to look for `NativeFoobar`
|
||||
// if it was added via JSI.
|
||||
//
|
||||
// We use a getter here rather than simply `globalThis.NativeFoobar` so that
|
||||
// if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
|
||||
const getter: () => NativeModuleInterface = () =>
|
||||
(globalThis as any).NativeFoobar;
|
||||
export default getter;
|
||||
|
||||
// Structs and function types for calling back into Typescript from Rust.
|
||||
export type UniffiRustFutureContinuationCallback = (
|
||||
data: bigint,
|
||||
pollResult: number
|
||||
) => void;
|
||||
type UniffiForeignFutureFree = (handle: bigint) => void;
|
||||
type UniffiCallbackInterfaceFree = (handle: bigint) => void;
|
||||
export type UniffiForeignFuture = {
|
||||
handle: bigint;
|
||||
free: UniffiForeignFutureFree;
|
||||
};
|
||||
export type UniffiForeignFutureStructU8 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteU8 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructU8
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructI8 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteI8 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructI8
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructU16 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteU16 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructU16
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructI16 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteI16 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructI16
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructU32 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteU32 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructU32
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructI32 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteI32 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructI32
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructU64 = {
|
||||
returnValue: bigint;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteU64 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructU64
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructI64 = {
|
||||
returnValue: bigint;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteI64 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructI64
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructF32 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteF32 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructF32
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructF64 = {
|
||||
returnValue: number;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteF64 = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructF64
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructPointer = {
|
||||
returnValue: bigint;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompletePointer = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructPointer
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructRustBuffer = {
|
||||
returnValue: Uint8Array;
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteRustBuffer = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructRustBuffer
|
||||
) => void;
|
||||
export type UniffiForeignFutureStructVoid = {
|
||||
callStatus: UniffiRustCallStatus;
|
||||
};
|
||||
export type UniffiForeignFutureCompleteVoid = (
|
||||
callbackData: bigint,
|
||||
result: UniffiForeignFutureStructVoid
|
||||
) => void;
|
||||
type UniffiCallbackInterfaceBinaryOperatorMethod0 = (
|
||||
uniffiHandle: bigint,
|
||||
lhs: bigint,
|
||||
rhs: bigint
|
||||
) => UniffiResult<bigint>;
|
||||
export type UniffiVTableCallbackInterfaceBinaryOperator = {
|
||||
perform: UniffiCallbackInterfaceBinaryOperatorMethod0;
|
||||
uniffiFree: UniffiCallbackInterfaceFree;
|
||||
};
|
||||
|
||||
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
||||
// ffi_definitions. However, we need it in the runtime.
|
||||
// We could:
|
||||
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
||||
// (b) import the generated declaration into the runtime (m a y b e) or…
|
||||
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
||||
//
|
||||
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
||||
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
||||
//
|
||||
// If you see the error:
|
||||
// ```
|
||||
// Type 'true' is not assignable to type 'false'.(2322)
|
||||
// ```
|
||||
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
||||
// `typescript/src/async-rust-call.ts` will need to be changed.
|
||||
//
|
||||
// If you see the error:
|
||||
// ```
|
||||
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
||||
// ```
|
||||
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
||||
// You should not generate this if that is the case.
|
||||
//
|
||||
// ('You' being the bindings generator maintainer).
|
||||
const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
|
||||
RuntimeUniffiRustFutureContinuationCallback,
|
||||
UniffiRustFutureContinuationCallback
|
||||
> = true;
|
||||
const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
|
||||
RuntimeUniffiForeignFuture,
|
||||
UniffiForeignFuture
|
||||
> = true;
|
||||
1271
packages/react-native-uniffi-russh/src/generated/foobar.ts
Normal file
1271
packages/react-native-uniffi-russh/src/generated/foobar.ts
Normal file
File diff suppressed because it is too large
Load Diff
41
packages/react-native-uniffi-russh/src/index.tsx
Normal file
41
packages/react-native-uniffi-russh/src/index.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
// Generated by uniffi-bindgen-react-native
|
||||
import installer from './NativeUniffiRussh';
|
||||
|
||||
// Register the rust crate with Hermes
|
||||
// - the boolean flag ensures this loads exactly once, even if the JS
|
||||
// code is reloaded (e.g. during development with metro).
|
||||
let rustInstalled = false;
|
||||
if (!rustInstalled) {
|
||||
installer.installRustCrate();
|
||||
rustInstalled = true;
|
||||
}
|
||||
|
||||
// Export the generated bindings to the app.
|
||||
export * from './generated/foobar';
|
||||
|
||||
// Now import the bindings so we can:
|
||||
// - intialize them
|
||||
// - export them as namespaced objects as the default export.
|
||||
import * as foobar from './generated/foobar';
|
||||
|
||||
// Initialize the generated bindings: mostly checksums, but also callbacks.
|
||||
// - the boolean flag ensures this loads exactly once, even if the JS code
|
||||
// is reloaded (e.g. during development with metro).
|
||||
let initialized = false;
|
||||
if (!initialized) {
|
||||
foobar.default.initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
// This provides parity with the index.web.ts version of this file.
|
||||
// The web version relies on an asynchronous fetch, which this doesn't
|
||||
// need, so we just no-op.
|
||||
export async function uniffiInitAsync() {
|
||||
// NOOP.
|
||||
}
|
||||
|
||||
// Export the crates as individually namespaced objects.
|
||||
export default {
|
||||
foobar,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user