// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate.
// Trust me, you don't want to mess with it!

import {
  ArrayBufferDataStream,
  FfiConverter,
  FfiConverterArrayBuffer,
  FfiConverterInt8,
  FfiConverterUInt8,
  FfiConverterInt16,
  FfiConverterUInt16,
  FfiConverterInt32,
  FfiConverterUInt32,
  FfiConverterInt64,
  FfiConverterUInt64,
  FfiConverterFloat32,
  FfiConverterFloat64,
  FfiConverterBoolean,
  FfiConverterBytes,
  FfiConverterString,
  UniFFICallbackHandler,
  UniFFICallbackMethodHandler,
  UniFFIError,
  UniFFIInternalError,
  UniFFITypeError,
  constructUniffiObject,
  handleRustResult,
  uniffiObjectPtr,
} from "moz-src:///toolkit/components/uniffi-js/js/UniFFI.sys.mjs";

// Objects intended to be used in the unit tests
export var UnitTestObjs = {
    uniffiObjectPtr,
};
/**
 * asyncRoundtripF32
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripF32(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterFloat32.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    258, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_f32
    FfiConverterFloat32.lower(v),
)
return handleRustResult(
    result,
    FfiConverterFloat32.lift.bind(FfiConverterFloat32),
    null,
)
}

/**
 * asyncRoundtripF64
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripF64(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterFloat64.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    259, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_f64
    FfiConverterFloat64.lower(v),
)
return handleRustResult(
    result,
    FfiConverterFloat64.lift.bind(FfiConverterFloat64),
    null,
)
}

/**
 * asyncRoundtripI16
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripI16(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterInt16.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    260, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i16
    FfiConverterInt16.lower(v),
)
return handleRustResult(
    result,
    FfiConverterInt16.lift.bind(FfiConverterInt16),
    null,
)
}

/**
 * asyncRoundtripI32
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripI32(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterInt32.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    261, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i32
    FfiConverterInt32.lower(v),
)
return handleRustResult(
    result,
    FfiConverterInt32.lift.bind(FfiConverterInt32),
    null,
)
}

/**
 * asyncRoundtripI64
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripI64(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterInt64.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    262, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i64
    FfiConverterInt64.lower(v),
)
return handleRustResult(
    result,
    FfiConverterInt64.lift.bind(FfiConverterInt64),
    null,
)
}

/**
 * asyncRoundtripI8
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripI8(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterInt8.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    263, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i8
    FfiConverterInt8.lower(v),
)
return handleRustResult(
    result,
    FfiConverterInt8.lift.bind(FfiConverterInt8),
    null,
)
}

/**
 * asyncRoundtripMap
 * @param {object} v
 * @returns {Promise<object>}}
 */
export async function asyncRoundtripMap(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterMapStringString.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    264, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_map
    FfiConverterMapStringString.lower(v),
)
return handleRustResult(
    result,
    FfiConverterMapStringString.lift.bind(FfiConverterMapStringString),
    null,
)
}

/**
 * asyncRoundtripObj
 * @param {AsyncInterface} v
 * @returns {Promise<AsyncInterface>}}
 */
export async function asyncRoundtripObj(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterTypeAsyncInterface.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    265, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_obj
    FfiConverterTypeAsyncInterface.lower(v),
)
return handleRustResult(
    result,
    FfiConverterTypeAsyncInterface.lift.bind(FfiConverterTypeAsyncInterface),
    null,
)
}

/**
 * asyncRoundtripString
 * @param {string} v
 * @returns {Promise<string>}}
 */
export async function asyncRoundtripString(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterString.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    266, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_string
    FfiConverterString.lower(v),
)
return handleRustResult(
    result,
    FfiConverterString.lift.bind(FfiConverterString),
    null,
)
}

/**
 * asyncRoundtripU16
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripU16(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterUInt16.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    267, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u16
    FfiConverterUInt16.lower(v),
)
return handleRustResult(
    result,
    FfiConverterUInt16.lift.bind(FfiConverterUInt16),
    null,
)
}

/**
 * asyncRoundtripU32
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripU32(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterUInt32.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    268, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u32
    FfiConverterUInt32.lower(v),
)
return handleRustResult(
    result,
    FfiConverterUInt32.lift.bind(FfiConverterUInt32),
    null,
)
}

/**
 * asyncRoundtripU64
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripU64(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterUInt64.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    269, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u64
    FfiConverterUInt64.lower(v),
)
return handleRustResult(
    result,
    FfiConverterUInt64.lift.bind(FfiConverterUInt64),
    null,
)
}

/**
 * asyncRoundtripU8
 * @param {number} v
 * @returns {Promise<number>}}
 */
export async function asyncRoundtripU8(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterUInt8.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    270, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u8
    FfiConverterUInt8.lower(v),
)
return handleRustResult(
    result,
    FfiConverterUInt8.lift.bind(FfiConverterUInt8),
    null,
)
}

/**
 * asyncRoundtripVec
 * @param {Array.<number>} v
 * @returns {Promise<Array.<number>>}}
 */
export async function asyncRoundtripVec(
    v) {
   
if (v instanceof UniffiSkipJsTypeCheck) {
    v = v.value;
} else {
    FfiConverterSequenceUInt32.checkType(v);
}
const result = await UniFFIScaffolding.callAsync(
    271, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_vec
    FfiConverterSequenceUInt32.lower(v),
)
return handleRustResult(
    result,
    FfiConverterSequenceUInt32.lift.bind(FfiConverterSequenceUInt32),
    null,
)
}

/**
 * asyncThrowError
 */
export async function asyncThrowError() {
   
const result = await UniFFIScaffolding.callAsync(
    272, // uniffi_uniffi_bindings_tests_fn_func_async_throw_error
)
return handleRustResult(
    result,
    (result) => undefined,
    FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
)
}

/**
 * cloneInterface
 * @param {TestInterface} int
 * @returns {TestInterface}
 */
export function cloneInterface(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestInterface.checkType(int);
}
const result = UniFFIScaffolding.callSync(
    273, // uniffi_uniffi_bindings_tests_fn_func_clone_interface
    FfiConverterTypeTestInterface.lower(int),
)
return handleRustResult(
    result,
    FfiConverterTypeTestInterface.lift.bind(FfiConverterTypeTestInterface),
    null,
)
}

/**
 * createAsyncTestTraitInterface
 * @param {number} value
 * @returns {Promise<AsyncTestTraitInterface>}}
 */
export async function createAsyncTestTraitInterface(
    value) {
   
if (value instanceof UniffiSkipJsTypeCheck) {
    value = value.value;
} else {
    FfiConverterUInt32.checkType(value);
}
const result = await UniFFIScaffolding.callAsyncWrapper(
    274, // uniffi_uniffi_bindings_tests_fn_func_create_async_test_trait_interface
    FfiConverterUInt32.lower(value),
)
return handleRustResult(
    result,
    FfiConverterTypeAsyncTestTraitInterface.lift.bind(FfiConverterTypeAsyncTestTraitInterface),
    null,
)
}

/**
 * Create an implementation of the interface in Rust
 * @param {number} value
 * @returns {TestTraitInterface}
 */
export function createTestTraitInterface(
    value) {
   
if (value instanceof UniffiSkipJsTypeCheck) {
    value = value.value;
} else {
    FfiConverterUInt32.checkType(value);
}
const result = UniFFIScaffolding.callSync(
    275, // uniffi_uniffi_bindings_tests_fn_func_create_test_trait_interface
    FfiConverterUInt32.lower(value),
)
return handleRustResult(
    result,
    FfiConverterTypeTestTraitInterface.lift.bind(FfiConverterTypeTestTraitInterface),
    null,
)
}

/**
 * funcWithDefault
 * @param {string} arg
 * @returns {string}
 */
export function funcWithDefault(
    arg = "DEFAULT") {
   
if (arg instanceof UniffiSkipJsTypeCheck) {
    arg = arg.value;
} else {
    FfiConverterString.checkType(arg);
}
const result = UniFFIScaffolding.callSync(
    276, // uniffi_uniffi_bindings_tests_fn_func_func_with_default
    FfiConverterString.lower(arg),
)
return handleRustResult(
    result,
    FfiConverterString.lift.bind(FfiConverterString),
    null,
)
}

/**
 * funcWithError
 * @param {number} input
 */
export function funcWithError(
    input) {
   
if (input instanceof UniffiSkipJsTypeCheck) {
    input = input.value;
} else {
    FfiConverterUInt32.checkType(input);
}
const result = UniFFIScaffolding.callSync(
    277, // uniffi_uniffi_bindings_tests_fn_func_func_with_error
    FfiConverterUInt32.lower(input),
)
return handleRustResult(
    result,
    (result) => undefined,
    FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
)
}

/**
 * funcWithFlatError
 * @param {number} input
 */
export function funcWithFlatError(
    input) {
   
if (input instanceof UniffiSkipJsTypeCheck) {
    input = input.value;
} else {
    FfiConverterUInt32.checkType(input);
}
const result = UniFFIScaffolding.callSync(
    278, // uniffi_uniffi_bindings_tests_fn_func_func_with_flat_error
    FfiConverterUInt32.lower(input),
)
return handleRustResult(
    result,
    (result) => undefined,
    FfiConverterTypeTestFlatError.lift.bind(FfiConverterTypeTestFlatError),
)
}

/**
 * Test a multi-word argument.  `the_argument` should be normalized to the naming style of the
 * foreign language.
 * @param {string} theArgument
 * @returns {string}
 */
export function funcWithMultiWordArg(
    theArgument) {
   
if (theArgument instanceof UniffiSkipJsTypeCheck) {
    theArgument = theArgument.value;
} else {
    FfiConverterString.checkType(theArgument);
}
const result = UniFFIScaffolding.callSync(
    279, // uniffi_uniffi_bindings_tests_fn_func_func_with_multi_word_arg
    FfiConverterString.lower(theArgument),
)
return handleRustResult(
    result,
    FfiConverterString.lift.bind(FfiConverterString),
    null,
)
}

/**
 * getCustomTypesDemo
 * @returns {Promise<CustomTypesDemo>}}
 */
export async function getCustomTypesDemo() {
   
const result = await UniFFIScaffolding.callAsyncWrapper(
    280, // uniffi_uniffi_bindings_tests_fn_func_get_custom_types_demo
)
return handleRustResult(
    result,
    FfiConverterTypeCustomTypesDemo.lift.bind(FfiConverterTypeCustomTypesDemo),
    null,
)
}

/**
 * invokeAsyncTestTraitInterfaceGetValue
 * @param {AsyncTestTraitInterface} int
 * @returns {Promise<number>}}
 */
export async function invokeAsyncTestTraitInterfaceGetValue(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeAsyncTestTraitInterface.checkType(int);
}
const result = await UniFFIScaffolding.callAsync(
    281, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_get_value
    FfiConverterTypeAsyncTestTraitInterface.lower(int),
)
return handleRustResult(
    result,
    FfiConverterUInt32.lift.bind(FfiConverterUInt32),
    null,
)
}

/**
 * invokeAsyncTestTraitInterfaceNoop
 * @param {AsyncTestTraitInterface} int
 */
export async function invokeAsyncTestTraitInterfaceNoop(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeAsyncTestTraitInterface.checkType(int);
}
const result = await UniFFIScaffolding.callAsync(
    282, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_noop
    FfiConverterTypeAsyncTestTraitInterface.lower(int),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeAsyncTestTraitInterfaceSetValue
 * @param {AsyncTestTraitInterface} int
 * @param {number} value
 */
export async function invokeAsyncTestTraitInterfaceSetValue(
    int, 
    value) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeAsyncTestTraitInterface.checkType(int);
}
if (value instanceof UniffiSkipJsTypeCheck) {
    value = value.value;
} else {
    FfiConverterUInt32.checkType(value);
}
const result = await UniFFIScaffolding.callAsync(
    283, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_set_value
    FfiConverterTypeAsyncTestTraitInterface.lower(int),
    FfiConverterUInt32.lower(value),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeAsyncTestTraitInterfaceThrowIfEqual
 * @param {AsyncTestTraitInterface} int
 * @param {CallbackInterfaceNumbers} numbers
 * @returns {Promise<CallbackInterfaceNumbers>}}
 */
export async function invokeAsyncTestTraitInterfaceThrowIfEqual(
    int, 
    numbers) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeAsyncTestTraitInterface.checkType(int);
}
if (numbers instanceof UniffiSkipJsTypeCheck) {
    numbers = numbers.value;
} else {
    FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers);
}
const result = await UniFFIScaffolding.callAsync(
    284, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_throw_if_equal
    FfiConverterTypeAsyncTestTraitInterface.lower(int),
    FfiConverterTypeCallbackInterfaceNumbers.lower(numbers),
)
return handleRustResult(
    result,
    FfiConverterTypeCallbackInterfaceNumbers.lift.bind(FfiConverterTypeCallbackInterfaceNumbers),
    FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
)
}

/**
 * invokeTestAsyncCallbackInterfaceGetValue
 * @param {TestAsyncCallbackInterface} cbi
 * @returns {Promise<number>}}
 */
export async function invokeTestAsyncCallbackInterfaceGetValue(
    cbi) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestAsyncCallbackInterface.checkType(cbi);
}
const result = await UniFFIScaffolding.callAsync(
    285, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_get_value
    FfiConverterTypeTestAsyncCallbackInterface.lower(cbi),
)
return handleRustResult(
    result,
    FfiConverterUInt32.lift.bind(FfiConverterUInt32),
    null,
)
}

/**
 * invokeTestAsyncCallbackInterfaceNoop
 * @param {TestAsyncCallbackInterface} cbi
 */
export async function invokeTestAsyncCallbackInterfaceNoop(
    cbi) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestAsyncCallbackInterface.checkType(cbi);
}
const result = await UniFFIScaffolding.callAsync(
    286, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_noop
    FfiConverterTypeTestAsyncCallbackInterface.lower(cbi),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeTestAsyncCallbackInterfaceSetValue
 * @param {TestAsyncCallbackInterface} cbi
 * @param {number} value
 */
export async function invokeTestAsyncCallbackInterfaceSetValue(
    cbi, 
    value) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestAsyncCallbackInterface.checkType(cbi);
}
if (value instanceof UniffiSkipJsTypeCheck) {
    value = value.value;
} else {
    FfiConverterUInt32.checkType(value);
}
const result = await UniFFIScaffolding.callAsync(
    287, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_set_value
    FfiConverterTypeTestAsyncCallbackInterface.lower(cbi),
    FfiConverterUInt32.lower(value),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeTestAsyncCallbackInterfaceThrowIfEqual
 * @param {TestAsyncCallbackInterface} cbi
 * @param {CallbackInterfaceNumbers} numbers
 * @returns {Promise<CallbackInterfaceNumbers>}}
 */
export async function invokeTestAsyncCallbackInterfaceThrowIfEqual(
    cbi, 
    numbers) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestAsyncCallbackInterface.checkType(cbi);
}
if (numbers instanceof UniffiSkipJsTypeCheck) {
    numbers = numbers.value;
} else {
    FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers);
}
const result = await UniFFIScaffolding.callAsync(
    288, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_throw_if_equal
    FfiConverterTypeTestAsyncCallbackInterface.lower(cbi),
    FfiConverterTypeCallbackInterfaceNumbers.lower(numbers),
)
return handleRustResult(
    result,
    FfiConverterTypeCallbackInterfaceNumbers.lift.bind(FfiConverterTypeCallbackInterfaceNumbers),
    FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
)
}

/**
 * invokeTestCallbackInterfaceGetValue
 * @param {TestCallbackInterface} cbi
 * @returns {number}
 */
export function invokeTestCallbackInterfaceGetValue(
    cbi) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestCallbackInterface.checkType(cbi);
}
const result = UniFFIScaffolding.callSync(
    289, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_get_value
    FfiConverterTypeTestCallbackInterface.lower(cbi),
)
return handleRustResult(
    result,
    FfiConverterUInt32.lift.bind(FfiConverterUInt32),
    null,
)
}

/**
 * invokeTestCallbackInterfaceNoop
 * @param {TestCallbackInterface} cbi
 */
export function invokeTestCallbackInterfaceNoop(
    cbi) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestCallbackInterface.checkType(cbi);
}
const result = UniFFIScaffolding.callSync(
    290, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_noop
    FfiConverterTypeTestCallbackInterface.lower(cbi),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeTestCallbackInterfaceSetValue
 * @param {TestCallbackInterface} cbi
 * @param {number} value
 */
export function invokeTestCallbackInterfaceSetValue(
    cbi, 
    value) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestCallbackInterface.checkType(cbi);
}
if (value instanceof UniffiSkipJsTypeCheck) {
    value = value.value;
} else {
    FfiConverterUInt32.checkType(value);
}
const result = UniFFIScaffolding.callSync(
    291, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_set_value
    FfiConverterTypeTestCallbackInterface.lower(cbi),
    FfiConverterUInt32.lower(value),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeTestCallbackInterfaceThrowIfEqual
 * @param {TestCallbackInterface} cbi
 * @param {CallbackInterfaceNumbers} numbers
 * @returns {CallbackInterfaceNumbers}
 */
export function invokeTestCallbackInterfaceThrowIfEqual(
    cbi, 
    numbers) {
   
if (cbi instanceof UniffiSkipJsTypeCheck) {
    cbi = cbi.value;
} else {
    FfiConverterTypeTestCallbackInterface.checkType(cbi);
}
if (numbers instanceof UniffiSkipJsTypeCheck) {
    numbers = numbers.value;
} else {
    FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers);
}
const result = UniFFIScaffolding.callSync(
    292, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_throw_if_equal
    FfiConverterTypeTestCallbackInterface.lower(cbi),
    FfiConverterTypeCallbackInterfaceNumbers.lower(numbers),
)
return handleRustResult(
    result,
    FfiConverterTypeCallbackInterfaceNumbers.lift.bind(FfiConverterTypeCallbackInterfaceNumbers),
    FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
)
}

/**
 * invokeTestTraitInterfaceGetValue
 * @param {TestTraitInterface} int
 * @returns {number}
 */
export function invokeTestTraitInterfaceGetValue(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestTraitInterface.checkType(int);
}
const result = UniFFIScaffolding.callSync(
    293, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_get_value
    FfiConverterTypeTestTraitInterface.lower(int),
)
return handleRustResult(
    result,
    FfiConverterUInt32.lift.bind(FfiConverterUInt32),
    null,
)
}

/**
 * invokeTestTraitInterfaceNoop
 * @param {TestTraitInterface} int
 */
export function invokeTestTraitInterfaceNoop(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestTraitInterface.checkType(int);
}
const result = UniFFIScaffolding.callSync(
    294, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_noop
    FfiConverterTypeTestTraitInterface.lower(int),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeTestTraitInterfaceSetValue
 * @param {TestTraitInterface} int
 * @param {number} value
 */
export function invokeTestTraitInterfaceSetValue(
    int, 
    value) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestTraitInterface.checkType(int);
}
if (value instanceof UniffiSkipJsTypeCheck) {
    value = value.value;
} else {
    FfiConverterUInt32.checkType(value);
}
const result = UniFFIScaffolding.callSync(
    295, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_set_value
    FfiConverterTypeTestTraitInterface.lower(int),
    FfiConverterUInt32.lower(value),
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}

/**
 * invokeTestTraitInterfaceThrowIfEqual
 * @param {TestTraitInterface} int
 * @param {CallbackInterfaceNumbers} numbers
 * @returns {CallbackInterfaceNumbers}
 */
export function invokeTestTraitInterfaceThrowIfEqual(
    int, 
    numbers) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestTraitInterface.checkType(int);
}
if (numbers instanceof UniffiSkipJsTypeCheck) {
    numbers = numbers.value;
} else {
    FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers);
}
const result = UniFFIScaffolding.callSync(
    296, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_throw_if_equal
    FfiConverterTypeTestTraitInterface.lower(int),
    FfiConverterTypeCallbackInterfaceNumbers.lower(numbers),
)
return handleRustResult(
    result,
    FfiConverterTypeCallbackInterfaceNumbers.lift.bind(FfiConverterTypeCallbackInterfaceNumbers),
    FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
)
}

/**
 * roundtripAsyncTestTraitInterface
 * @param {AsyncTestTraitInterface} int
 * @returns {AsyncTestTraitInterface}
 */
export function roundtripAsyncTestTraitInterface(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeAsyncTestTraitInterface.checkType(int);
}
const result = UniFFIScaffolding.callSync(
    297, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_async_test_trait_interface
    FfiConverterTypeAsyncTestTraitInterface.lower(int),
)
return handleRustResult(
    result,
    FfiConverterTypeAsyncTestTraitInterface.lift.bind(FfiConverterTypeAsyncTestTraitInterface),
    null,
)
}

/**
 * roundtripAsyncTestTraitInterfaceList
 * @param {Array.<AsyncTestTraitInterface>} intList
 * @returns {Array.<AsyncTestTraitInterface>}
 */
export function roundtripAsyncTestTraitInterfaceList(
    intList) {
   
if (intList instanceof UniffiSkipJsTypeCheck) {
    intList = intList.value;
} else {
    FfiConverterSequenceTypeAsyncTestTraitInterface.checkType(intList);
}
const result = UniFFIScaffolding.callSync(
    298, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_async_test_trait_interface_list
    FfiConverterSequenceTypeAsyncTestTraitInterface.lower(intList),
)
return handleRustResult(
    result,
    FfiConverterSequenceTypeAsyncTestTraitInterface.lift.bind(FfiConverterSequenceTypeAsyncTestTraitInterface),
    null,
)
}

/**
 * roundtripBool
 * @param {boolean} a
 * @returns {boolean}
 */
export function roundtripBool(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterBoolean.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    299, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_bool
    FfiConverterBoolean.lower(a),
)
return handleRustResult(
    result,
    FfiConverterBoolean.lift.bind(FfiConverterBoolean),
    null,
)
}

/**
 * roundtripComplexCompound
 * @param {?Array.<object>} a
 * @returns {?Array.<object>}
 */
export function roundtripComplexCompound(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterOptionalSequenceMapStringUInt32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    300, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_compound
    FfiConverterOptionalSequenceMapStringUInt32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterOptionalSequenceMapStringUInt32.lift.bind(FfiConverterOptionalSequenceMapStringUInt32),
    null,
)
}

/**
 * roundtripComplexEnum
 * @param {ComplexEnum[keyof ComplexEnum]} en
 * @returns {ComplexEnum[keyof ComplexEnum]}
 */
export function roundtripComplexEnum(
    en) {
   
if (en instanceof UniffiSkipJsTypeCheck) {
    en = en.value;
} else {
    FfiConverterTypeComplexEnum.checkType(en);
}
const result = UniFFIScaffolding.callSync(
    301, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_enum
    FfiConverterTypeComplexEnum.lower(en),
)
return handleRustResult(
    result,
    FfiConverterTypeComplexEnum.lift.bind(FfiConverterTypeComplexEnum),
    null,
)
}

/**
 * roundtripComplexRec
 * @param {ComplexRec} rec
 * @returns {ComplexRec}
 */
export function roundtripComplexRec(
    rec) {
   
if (rec instanceof UniffiSkipJsTypeCheck) {
    rec = rec.value;
} else {
    FfiConverterTypeComplexRec.checkType(rec);
}
const result = UniFFIScaffolding.callSync(
    302, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_rec
    FfiConverterTypeComplexRec.lower(rec),
)
return handleRustResult(
    result,
    FfiConverterTypeComplexRec.lift.bind(FfiConverterTypeComplexRec),
    null,
)
}

/**
 * roundtripCustomType
 * @param {Handle} handle
 * @returns {Handle}
 */
export function roundtripCustomType(
    handle) {
   
if (handle instanceof UniffiSkipJsTypeCheck) {
    handle = handle.value;
} else {
    FfiConverterTypeHandle.checkType(handle);
}
const result = UniFFIScaffolding.callSync(
    303, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_custom_type
    FfiConverterTypeHandle.lower(handle),
)
return handleRustResult(
    result,
    FfiConverterTypeHandle.lift.bind(FfiConverterTypeHandle),
    null,
)
}

/**
 * roundtripEnumNoData
 * @param {EnumNoData[keyof EnumNoData]} en
 * @returns {EnumNoData[keyof EnumNoData]}
 */
export function roundtripEnumNoData(
    en) {
   
if (en instanceof UniffiSkipJsTypeCheck) {
    en = en.value;
} else {
    FfiConverterTypeEnumNoData.checkType(en);
}
const result = UniFFIScaffolding.callSync(
    304, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_enum_no_data
    FfiConverterTypeEnumNoData.lower(en),
)
return handleRustResult(
    result,
    FfiConverterTypeEnumNoData.lift.bind(FfiConverterTypeEnumNoData),
    null,
)
}

/**
 * roundtripEnumWithData
 * @param {EnumWithData[keyof EnumWithData]} en
 * @returns {EnumWithData[keyof EnumWithData]}
 */
export function roundtripEnumWithData(
    en) {
   
if (en instanceof UniffiSkipJsTypeCheck) {
    en = en.value;
} else {
    FfiConverterTypeEnumWithData.checkType(en);
}
const result = UniFFIScaffolding.callSync(
    305, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_enum_with_data
    FfiConverterTypeEnumWithData.lower(en),
)
return handleRustResult(
    result,
    FfiConverterTypeEnumWithData.lift.bind(FfiConverterTypeEnumWithData),
    null,
)
}

/**
 * roundtripF32
 * @param {number} a
 * @returns {number}
 */
export function roundtripF32(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterFloat32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    306, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_f32
    FfiConverterFloat32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterFloat32.lift.bind(FfiConverterFloat32),
    null,
)
}

/**
 * roundtripF64
 * @param {number} a
 * @returns {number}
 */
export function roundtripF64(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterFloat64.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    307, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_f64
    FfiConverterFloat64.lower(a),
)
return handleRustResult(
    result,
    FfiConverterFloat64.lift.bind(FfiConverterFloat64),
    null,
)
}

/**
 * roundtripHashMap
 * @param {object} a
 * @returns {object}
 */
export function roundtripHashMap(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterMapStringUInt32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    308, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_hash_map
    FfiConverterMapStringUInt32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterMapStringUInt32.lift.bind(FfiConverterMapStringUInt32),
    null,
)
}

/**
 * roundtripI16
 * @param {number} a
 * @returns {number}
 */
export function roundtripI16(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterInt16.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    309, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i16
    FfiConverterInt16.lower(a),
)
return handleRustResult(
    result,
    FfiConverterInt16.lift.bind(FfiConverterInt16),
    null,
)
}

/**
 * roundtripI32
 * @param {number} a
 * @returns {number}
 */
export function roundtripI32(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterInt32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    310, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i32
    FfiConverterInt32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterInt32.lift.bind(FfiConverterInt32),
    null,
)
}

/**
 * roundtripI64
 * @param {number} a
 * @returns {number}
 */
export function roundtripI64(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterInt64.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    311, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i64
    FfiConverterInt64.lower(a),
)
return handleRustResult(
    result,
    FfiConverterInt64.lift.bind(FfiConverterInt64),
    null,
)
}

/**
 * roundtripI8
 * @param {number} a
 * @returns {number}
 */
export function roundtripI8(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterInt8.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    312, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i8
    FfiConverterInt8.lower(a),
)
return handleRustResult(
    result,
    FfiConverterInt8.lift.bind(FfiConverterInt8),
    null,
)
}

/**
 * roundtripOption
 * @param {?number} a
 * @returns {?number}
 */
export function roundtripOption(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterOptionalUInt32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    313, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_option
    FfiConverterOptionalUInt32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterOptionalUInt32.lift.bind(FfiConverterOptionalUInt32),
    null,
)
}

/**
 * roundtripSimpleRec
 * @param {SimpleRec} rec
 * @returns {Promise<SimpleRec>}}
 */
export async function roundtripSimpleRec(
    rec) {
   
if (rec instanceof UniffiSkipJsTypeCheck) {
    rec = rec.value;
} else {
    FfiConverterTypeSimpleRec.checkType(rec);
}
const result = await UniFFIScaffolding.callAsyncWrapper(
    314, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_simple_rec
    FfiConverterTypeSimpleRec.lower(rec),
)
return handleRustResult(
    result,
    FfiConverterTypeSimpleRec.lift.bind(FfiConverterTypeSimpleRec),
    null,
)
}

/**
 * roundtripString
 * @param {string} a
 * @returns {string}
 */
export function roundtripString(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterString.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    315, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_string
    FfiConverterString.lower(a),
)
return handleRustResult(
    result,
    FfiConverterString.lift.bind(FfiConverterString),
    null,
)
}

/**
 * roundtripTestTraitInterface
 * @param {TestTraitInterface} int
 * @returns {TestTraitInterface}
 */
export function roundtripTestTraitInterface(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestTraitInterface.checkType(int);
}
const result = UniFFIScaffolding.callSync(
    316, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_test_trait_interface
    FfiConverterTypeTestTraitInterface.lower(int),
)
return handleRustResult(
    result,
    FfiConverterTypeTestTraitInterface.lift.bind(FfiConverterTypeTestTraitInterface),
    null,
)
}

/**
 * roundtripTestTraitInterfaceList
 * @param {Array.<TestTraitInterface>} intList
 * @returns {Array.<TestTraitInterface>}
 */
export function roundtripTestTraitInterfaceList(
    intList) {
   
if (intList instanceof UniffiSkipJsTypeCheck) {
    intList = intList.value;
} else {
    FfiConverterSequenceTypeTestTraitInterface.checkType(intList);
}
const result = UniFFIScaffolding.callSync(
    317, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_test_trait_interface_list
    FfiConverterSequenceTypeTestTraitInterface.lower(intList),
)
return handleRustResult(
    result,
    FfiConverterSequenceTypeTestTraitInterface.lift.bind(FfiConverterSequenceTypeTestTraitInterface),
    null,
)
}

/**
 * roundtripTimeIntervalMs
 * @param {TimeIntervalMs} time
 * @returns {Promise<TimeIntervalMs>}}
 */
export async function roundtripTimeIntervalMs(
    time) {
   
if (time instanceof UniffiSkipJsTypeCheck) {
    time = time.value;
} else {
    FfiConverterTypeTimeIntervalMs.checkType(time);
}
const result = await UniFFIScaffolding.callAsyncWrapper(
    318, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_ms
    FfiConverterTypeTimeIntervalMs.lower(time),
)
return handleRustResult(
    result,
    FfiConverterTypeTimeIntervalMs.lift.bind(FfiConverterTypeTimeIntervalMs),
    null,
)
}

/**
 * roundtripTimeIntervalSecDbl
 * @param {TimeIntervalSecDbl} time
 * @returns {Promise<TimeIntervalSecDbl>}}
 */
export async function roundtripTimeIntervalSecDbl(
    time) {
   
if (time instanceof UniffiSkipJsTypeCheck) {
    time = time.value;
} else {
    FfiConverterTypeTimeIntervalSecDbl.checkType(time);
}
const result = await UniFFIScaffolding.callAsyncWrapper(
    319, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_sec_dbl
    FfiConverterTypeTimeIntervalSecDbl.lower(time),
)
return handleRustResult(
    result,
    FfiConverterTypeTimeIntervalSecDbl.lift.bind(FfiConverterTypeTimeIntervalSecDbl),
    null,
)
}

/**
 * roundtripTimeIntervalSecFlt
 * @param {TimeIntervalSecFlt} time
 * @returns {Promise<TimeIntervalSecFlt>}}
 */
export async function roundtripTimeIntervalSecFlt(
    time) {
   
if (time instanceof UniffiSkipJsTypeCheck) {
    time = time.value;
} else {
    FfiConverterTypeTimeIntervalSecFlt.checkType(time);
}
const result = await UniFFIScaffolding.callAsyncWrapper(
    320, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_sec_flt
    FfiConverterTypeTimeIntervalSecFlt.lower(time),
)
return handleRustResult(
    result,
    FfiConverterTypeTimeIntervalSecFlt.lift.bind(FfiConverterTypeTimeIntervalSecFlt),
    null,
)
}

/**
 * roundtripU16
 * @param {number} a
 * @returns {number}
 */
export function roundtripU16(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterUInt16.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    321, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u16
    FfiConverterUInt16.lower(a),
)
return handleRustResult(
    result,
    FfiConverterUInt16.lift.bind(FfiConverterUInt16),
    null,
)
}

/**
 * roundtripU32
 * @param {number} a
 * @returns {number}
 */
export function roundtripU32(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterUInt32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    322, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u32
    FfiConverterUInt32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterUInt32.lift.bind(FfiConverterUInt32),
    null,
)
}

/**
 * roundtripU64
 * @param {number} a
 * @returns {number}
 */
export function roundtripU64(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterUInt64.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    323, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u64
    FfiConverterUInt64.lower(a),
)
return handleRustResult(
    result,
    FfiConverterUInt64.lift.bind(FfiConverterUInt64),
    null,
)
}

/**
 * roundtripU8
 * @param {number} a
 * @returns {number}
 */
export function roundtripU8(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterUInt8.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    324, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u8
    FfiConverterUInt8.lower(a),
)
return handleRustResult(
    result,
    FfiConverterUInt8.lift.bind(FfiConverterUInt8),
    null,
)
}

/**
 * roundtripUrl
 * @param {Url} url
 * @returns {Promise<Url>}}
 */
export async function roundtripUrl(
    url) {
   
if (url instanceof UniffiSkipJsTypeCheck) {
    url = url.value;
} else {
    FfiConverterTypeUrl.checkType(url);
}
const result = await UniFFIScaffolding.callAsyncWrapper(
    325, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_url
    FfiConverterTypeUrl.lower(url),
)
return handleRustResult(
    result,
    FfiConverterTypeUrl.lift.bind(FfiConverterTypeUrl),
    null,
)
}

/**
 * roundtripVec
 * @param {Array.<number>} a
 * @returns {Array.<number>}
 */
export function roundtripVec(
    a) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterSequenceUInt32.checkType(a);
}
const result = UniFFIScaffolding.callSync(
    326, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_vec
    FfiConverterSequenceUInt32.lower(a),
)
return handleRustResult(
    result,
    FfiConverterSequenceUInt32.lift.bind(FfiConverterSequenceUInt32),
    null,
)
}

/**
 * Complex test: input a bunch of different values and add them together
 * @param {number} a
 * @param {number} b
 * @param {number} c
 * @param {number} d
 * @param {number} e
 * @param {number} f
 * @param {number} g
 * @param {number} h
 * @param {number} i
 * @param {number} j
 * @param {boolean} negate
 * @returns {number}
 */
export function sumWithManyTypes(
    a, 
    b, 
    c, 
    d, 
    e, 
    f, 
    g, 
    h, 
    i, 
    j, 
    negate) {
   
if (a instanceof UniffiSkipJsTypeCheck) {
    a = a.value;
} else {
    FfiConverterUInt8.checkType(a);
}
if (b instanceof UniffiSkipJsTypeCheck) {
    b = b.value;
} else {
    FfiConverterInt8.checkType(b);
}
if (c instanceof UniffiSkipJsTypeCheck) {
    c = c.value;
} else {
    FfiConverterUInt16.checkType(c);
}
if (d instanceof UniffiSkipJsTypeCheck) {
    d = d.value;
} else {
    FfiConverterInt16.checkType(d);
}
if (e instanceof UniffiSkipJsTypeCheck) {
    e = e.value;
} else {
    FfiConverterUInt32.checkType(e);
}
if (f instanceof UniffiSkipJsTypeCheck) {
    f = f.value;
} else {
    FfiConverterInt32.checkType(f);
}
if (g instanceof UniffiSkipJsTypeCheck) {
    g = g.value;
} else {
    FfiConverterUInt64.checkType(g);
}
if (h instanceof UniffiSkipJsTypeCheck) {
    h = h.value;
} else {
    FfiConverterInt64.checkType(h);
}
if (i instanceof UniffiSkipJsTypeCheck) {
    i = i.value;
} else {
    FfiConverterFloat32.checkType(i);
}
if (j instanceof UniffiSkipJsTypeCheck) {
    j = j.value;
} else {
    FfiConverterFloat64.checkType(j);
}
if (negate instanceof UniffiSkipJsTypeCheck) {
    negate = negate.value;
} else {
    FfiConverterBoolean.checkType(negate);
}
const result = UniFFIScaffolding.callSync(
    327, // uniffi_uniffi_bindings_tests_fn_func_sum_with_many_types
    FfiConverterUInt8.lower(a),
    FfiConverterInt8.lower(b),
    FfiConverterUInt16.lower(c),
    FfiConverterInt16.lower(d),
    FfiConverterUInt32.lower(e),
    FfiConverterInt32.lower(f),
    FfiConverterUInt64.lower(g),
    FfiConverterInt64.lower(h),
    FfiConverterFloat32.lower(i),
    FfiConverterFloat64.lower(j),
    FfiConverterBoolean.lower(negate),
)
return handleRustResult(
    result,
    FfiConverterFloat64.lift.bind(FfiConverterFloat64),
    null,
)
}

/**
 * swapTestInterfaces
 * @param {TwoTestInterfaces} interfaces
 * @returns {TwoTestInterfaces}
 */
export function swapTestInterfaces(
    interfaces) {
   
if (interfaces instanceof UniffiSkipJsTypeCheck) {
    interfaces = interfaces.value;
} else {
    FfiConverterTypeTwoTestInterfaces.checkType(interfaces);
}
const result = UniFFIScaffolding.callSync(
    328, // uniffi_uniffi_bindings_tests_fn_func_swap_test_interfaces
    FfiConverterTypeTwoTestInterfaces.lower(interfaces),
)
return handleRustResult(
    result,
    FfiConverterTypeTwoTestInterfaces.lift.bind(FfiConverterTypeTwoTestInterfaces),
    null,
)
}

/**
 * testFunc
 */
export function testFunc() {
   
const result = UniFFIScaffolding.callSync(
    329, // uniffi_uniffi_bindings_tests_fn_func_test_func
)
return handleRustResult(
    result,
    (result) => undefined,
    null,
)
}




/**
 * CallbackInterfaceNumbers
 */
export class CallbackInterfaceNumbers {
    constructor(
        {
            a, 
            b
        } = {
            a: undefined, 
            b: undefined
        }
    ) {
        try {
            FfiConverterUInt32.checkType(a)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("a");
            }
            throw e;
        }
        try {
            FfiConverterUInt32.checkType(b)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("b");
            }
            throw e;
        }
        /**
         * @type {number}
         */
        this.a = a;
        /**
         * @type {number}
         */
        this.b = b;
    }

    equals(other) {
        return (
            this.a == other.a
            && this.b == other.b
        )
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeCallbackInterfaceNumbers extends FfiConverterArrayBuffer {
    static read(dataStream) {
        return new CallbackInterfaceNumbers({
            a: FfiConverterUInt32.read(dataStream),
            b: FfiConverterUInt32.read(dataStream),
        });
    }
    static write(dataStream, value) {
        FfiConverterUInt32.write(dataStream, value.a);
        FfiConverterUInt32.write(dataStream, value.b);
    }

    static computeSize(value) {
        let totalSize = 0;
        totalSize += FfiConverterUInt32.computeSize(value.a);
        totalSize += FfiConverterUInt32.computeSize(value.b);
        return totalSize
    }

    static checkType(value) {
        super.checkType(value);
        if (!(value instanceof CallbackInterfaceNumbers)) {
            throw new UniFFITypeError(`Expected 'CallbackInterfaceNumbers', found '${typeof value}'`);
        }
        try {
            FfiConverterUInt32.checkType(value.a);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".a");
            }
            throw e;
        }
        try {
            FfiConverterUInt32.checkType(value.b);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".b");
            }
            throw e;
        }
    }
}




















/**
 * SimpleRec
 */
export class SimpleRec {
    constructor(
        {
            a
        } = {
            a: undefined
        }
    ) {
        try {
            FfiConverterUInt8.checkType(a)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("a");
            }
            throw e;
        }
        /**
         * @type {number}
         */
        this.a = a;
    }

    equals(other) {
        return (
            this.a == other.a
        )
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeSimpleRec extends FfiConverterArrayBuffer {
    static read(dataStream) {
        return new SimpleRec({
            a: FfiConverterUInt8.read(dataStream),
        });
    }
    static write(dataStream, value) {
        FfiConverterUInt8.write(dataStream, value.a);
    }

    static computeSize(value) {
        let totalSize = 0;
        totalSize += FfiConverterUInt8.computeSize(value.a);
        return totalSize
    }

    static checkType(value) {
        super.checkType(value);
        if (!(value instanceof SimpleRec)) {
            throw new UniFFITypeError(`Expected 'SimpleRec', found '${typeof value}'`);
        }
        try {
            FfiConverterUInt8.checkType(value.a);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".a");
            }
            throw e;
        }
    }
}
/**
 * ComplexRec
 */
export class ComplexRec {
    constructor(
        {
            fieldU8, 
            fieldI8, 
            fieldU16, 
            fieldI16, 
            fieldU32, 
            fieldI32, 
            fieldU64, 
            fieldI64, 
            fieldF32, 
            fieldF64, 
            fieldString= "DefaultString", 
            fieldRec
        } = {
            fieldU8: undefined, 
            fieldI8: undefined, 
            fieldU16: undefined, 
            fieldI16: undefined, 
            fieldU32: undefined, 
            fieldI32: undefined, 
            fieldU64: undefined, 
            fieldI64: undefined, 
            fieldF32: undefined, 
            fieldF64: undefined, 
            fieldString: undefined, 
            fieldRec: undefined
        }
    ) {
        try {
            FfiConverterUInt8.checkType(fieldU8)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldU8");
            }
            throw e;
        }
        try {
            FfiConverterInt8.checkType(fieldI8)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldI8");
            }
            throw e;
        }
        try {
            FfiConverterUInt16.checkType(fieldU16)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldU16");
            }
            throw e;
        }
        try {
            FfiConverterInt16.checkType(fieldI16)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldI16");
            }
            throw e;
        }
        try {
            FfiConverterUInt32.checkType(fieldU32)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldU32");
            }
            throw e;
        }
        try {
            FfiConverterInt32.checkType(fieldI32)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldI32");
            }
            throw e;
        }
        try {
            FfiConverterUInt64.checkType(fieldU64)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldU64");
            }
            throw e;
        }
        try {
            FfiConverterInt64.checkType(fieldI64)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldI64");
            }
            throw e;
        }
        try {
            FfiConverterFloat32.checkType(fieldF32)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldF32");
            }
            throw e;
        }
        try {
            FfiConverterFloat64.checkType(fieldF64)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldF64");
            }
            throw e;
        }
        try {
            FfiConverterString.checkType(fieldString)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldString");
            }
            throw e;
        }
        try {
            FfiConverterTypeSimpleRec.checkType(fieldRec)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("fieldRec");
            }
            throw e;
        }
        /**
         * @type {number}
         */
        this.fieldU8 = fieldU8;
        /**
         * @type {number}
         */
        this.fieldI8 = fieldI8;
        /**
         * @type {number}
         */
        this.fieldU16 = fieldU16;
        /**
         * @type {number}
         */
        this.fieldI16 = fieldI16;
        /**
         * @type {number}
         */
        this.fieldU32 = fieldU32;
        /**
         * @type {number}
         */
        this.fieldI32 = fieldI32;
        /**
         * @type {number}
         */
        this.fieldU64 = fieldU64;
        /**
         * @type {number}
         */
        this.fieldI64 = fieldI64;
        /**
         * @type {number}
         */
        this.fieldF32 = fieldF32;
        /**
         * @type {number}
         */
        this.fieldF64 = fieldF64;
        /**
         * @type {string}
         */
        this.fieldString = fieldString;
        /**
         * @type {SimpleRec}
         */
        this.fieldRec = fieldRec;
    }

    equals(other) {
        return (
            this.fieldU8 == other.fieldU8
            && this.fieldI8 == other.fieldI8
            && this.fieldU16 == other.fieldU16
            && this.fieldI16 == other.fieldI16
            && this.fieldU32 == other.fieldU32
            && this.fieldI32 == other.fieldI32
            && this.fieldU64 == other.fieldU64
            && this.fieldI64 == other.fieldI64
            && this.fieldF32 == other.fieldF32
            && this.fieldF64 == other.fieldF64
            && this.fieldString == other.fieldString
            && this.fieldRec.equals(other.fieldRec)
        )
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeComplexRec extends FfiConverterArrayBuffer {
    static read(dataStream) {
        return new ComplexRec({
            fieldU8: FfiConverterUInt8.read(dataStream),
            fieldI8: FfiConverterInt8.read(dataStream),
            fieldU16: FfiConverterUInt16.read(dataStream),
            fieldI16: FfiConverterInt16.read(dataStream),
            fieldU32: FfiConverterUInt32.read(dataStream),
            fieldI32: FfiConverterInt32.read(dataStream),
            fieldU64: FfiConverterUInt64.read(dataStream),
            fieldI64: FfiConverterInt64.read(dataStream),
            fieldF32: FfiConverterFloat32.read(dataStream),
            fieldF64: FfiConverterFloat64.read(dataStream),
            fieldString: FfiConverterString.read(dataStream),
            fieldRec: FfiConverterTypeSimpleRec.read(dataStream),
        });
    }
    static write(dataStream, value) {
        FfiConverterUInt8.write(dataStream, value.fieldU8);
        FfiConverterInt8.write(dataStream, value.fieldI8);
        FfiConverterUInt16.write(dataStream, value.fieldU16);
        FfiConverterInt16.write(dataStream, value.fieldI16);
        FfiConverterUInt32.write(dataStream, value.fieldU32);
        FfiConverterInt32.write(dataStream, value.fieldI32);
        FfiConverterUInt64.write(dataStream, value.fieldU64);
        FfiConverterInt64.write(dataStream, value.fieldI64);
        FfiConverterFloat32.write(dataStream, value.fieldF32);
        FfiConverterFloat64.write(dataStream, value.fieldF64);
        FfiConverterString.write(dataStream, value.fieldString);
        FfiConverterTypeSimpleRec.write(dataStream, value.fieldRec);
    }

    static computeSize(value) {
        let totalSize = 0;
        totalSize += FfiConverterUInt8.computeSize(value.fieldU8);
        totalSize += FfiConverterInt8.computeSize(value.fieldI8);
        totalSize += FfiConverterUInt16.computeSize(value.fieldU16);
        totalSize += FfiConverterInt16.computeSize(value.fieldI16);
        totalSize += FfiConverterUInt32.computeSize(value.fieldU32);
        totalSize += FfiConverterInt32.computeSize(value.fieldI32);
        totalSize += FfiConverterUInt64.computeSize(value.fieldU64);
        totalSize += FfiConverterInt64.computeSize(value.fieldI64);
        totalSize += FfiConverterFloat32.computeSize(value.fieldF32);
        totalSize += FfiConverterFloat64.computeSize(value.fieldF64);
        totalSize += FfiConverterString.computeSize(value.fieldString);
        totalSize += FfiConverterTypeSimpleRec.computeSize(value.fieldRec);
        return totalSize
    }

    static checkType(value) {
        super.checkType(value);
        if (!(value instanceof ComplexRec)) {
            throw new UniFFITypeError(`Expected 'ComplexRec', found '${typeof value}'`);
        }
        try {
            FfiConverterUInt8.checkType(value.fieldU8);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldU8");
            }
            throw e;
        }
        try {
            FfiConverterInt8.checkType(value.fieldI8);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldI8");
            }
            throw e;
        }
        try {
            FfiConverterUInt16.checkType(value.fieldU16);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldU16");
            }
            throw e;
        }
        try {
            FfiConverterInt16.checkType(value.fieldI16);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldI16");
            }
            throw e;
        }
        try {
            FfiConverterUInt32.checkType(value.fieldU32);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldU32");
            }
            throw e;
        }
        try {
            FfiConverterInt32.checkType(value.fieldI32);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldI32");
            }
            throw e;
        }
        try {
            FfiConverterUInt64.checkType(value.fieldU64);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldU64");
            }
            throw e;
        }
        try {
            FfiConverterInt64.checkType(value.fieldI64);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldI64");
            }
            throw e;
        }
        try {
            FfiConverterFloat32.checkType(value.fieldF32);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldF32");
            }
            throw e;
        }
        try {
            FfiConverterFloat64.checkType(value.fieldF64);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldF64");
            }
            throw e;
        }
        try {
            FfiConverterString.checkType(value.fieldString);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldString");
            }
            throw e;
        }
        try {
            FfiConverterTypeSimpleRec.checkType(value.fieldRec);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".fieldRec");
            }
            throw e;
        }
    }
}
export class FfiConverterTypeUrl extends FfiConverter {
    static lift(value) {
        const builtinVal = FfiConverterString.lift(value);
        return new URL(builtinVal);
    }

    static lower(value) {
        const builtinVal = value.toString();
        return FfiConverterString.lower(builtinVal);
    }

    static write(dataStream, value) {
        const builtinVal = value.toString();
        FfiConverterString.write(dataStream, builtinVal);
    }

    static read(dataStream) {
        const builtinVal = FfiConverterString.read(dataStream);
        return new URL(builtinVal);
    }

    static computeSize(value) {
        const builtinVal = value.toString();
        return FfiConverterString.computeSize(builtinVal);
    }

    static checkType(value) {
        if (value === null || value === undefined) {
            throw new TypeError("value is null or undefined");
        }
        if (value?.constructor?.name !== "URL") {
            throw new TypeError(`${value} is not a URL`);
        }
    }
}
export class FfiConverterTypeHandle extends FfiConverter {
    static lift(value) {
        return FfiConverterUInt64.lift(value);
    }

    static lower(value) {
        return FfiConverterUInt64.lower(value);
    }

    static write(dataStream, value) {
        FfiConverterUInt64.write(dataStream, value);
    }

    static read(dataStream) {
        const builtinVal = FfiConverterUInt64.read(dataStream);
        return builtinVal;
    }

    static computeSize(value) {
        return FfiConverterUInt64.computeSize(value);
    }

    static checkType(value) {
        if (value === null || value === undefined) {
            throw new TypeError("value is null or undefined");
        }
    }
}
export class FfiConverterTypeTimeIntervalMs extends FfiConverter {
    static lift(value) {
        const builtinVal = FfiConverterInt64.lift(value);
        return new Date(builtinVal);
    }

    static lower(value) {
        const builtinVal = value.getTime();
        return FfiConverterInt64.lower(builtinVal);
    }

    static write(dataStream, value) {
        const builtinVal = value.getTime();
        FfiConverterInt64.write(dataStream, builtinVal);
    }

    static read(dataStream) {
        const builtinVal = FfiConverterInt64.read(dataStream);
        return new Date(builtinVal);
    }

    static computeSize(value) {
        const builtinVal = value.getTime();
        return FfiConverterInt64.computeSize(builtinVal);
    }

    static checkType(value) {
        if (value === null || value === undefined) {
            throw new TypeError("value is null or undefined");
        }
        if (value?.constructor?.name !== "Date") {
            throw new TypeError(`${value} is not a Date`);
        }
    }
}
export class FfiConverterTypeTimeIntervalSecDbl extends FfiConverter {
    static lift(value) {
        const builtinVal = FfiConverterFloat64.lift(value);
        return new Date(builtinVal * 1000);
    }

    static lower(value) {
        const builtinVal = value.getTime() / 1000;
        return FfiConverterFloat64.lower(builtinVal);
    }

    static write(dataStream, value) {
        const builtinVal = value.getTime() / 1000;
        FfiConverterFloat64.write(dataStream, builtinVal);
    }

    static read(dataStream) {
        const builtinVal = FfiConverterFloat64.read(dataStream);
        return new Date(builtinVal * 1000);
    }

    static computeSize(value) {
        const builtinVal = value.getTime() / 1000;
        return FfiConverterFloat64.computeSize(builtinVal);
    }

    static checkType(value) {
        if (value === null || value === undefined) {
            throw new TypeError("value is null or undefined");
        }
        if (value?.constructor?.name !== "Date") {
            throw new TypeError(`${value} is not a Date`);
        }
    }
}
export class FfiConverterTypeTimeIntervalSecFlt extends FfiConverter {
    static lift(value) {
        return FfiConverterFloat32.lift(value);
    }

    static lower(value) {
        return FfiConverterFloat32.lower(value);
    }

    static write(dataStream, value) {
        FfiConverterFloat32.write(dataStream, value);
    }

    static read(dataStream) {
        const builtinVal = FfiConverterFloat32.read(dataStream);
        return builtinVal;
    }

    static computeSize(value) {
        return FfiConverterFloat32.computeSize(value);
    }

    static checkType(value) {
        if (value === null || value === undefined) {
            throw new TypeError("value is null or undefined");
        }
    }
}
/**
 * CustomTypesDemo
 */
export class CustomTypesDemo {
    constructor(
        {
            url, 
            handle, 
            timeIntervalMs, 
            timeIntervalSecDbl, 
            timeIntervalSecFlt
        } = {
            url: undefined, 
            handle: undefined, 
            timeIntervalMs: undefined, 
            timeIntervalSecDbl: undefined, 
            timeIntervalSecFlt: undefined
        }
    ) {
        try {
            FfiConverterTypeUrl.checkType(url)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("url");
            }
            throw e;
        }
        try {
            FfiConverterTypeHandle.checkType(handle)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("handle");
            }
            throw e;
        }
        try {
            FfiConverterTypeTimeIntervalMs.checkType(timeIntervalMs)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("timeIntervalMs");
            }
            throw e;
        }
        try {
            FfiConverterTypeTimeIntervalSecDbl.checkType(timeIntervalSecDbl)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("timeIntervalSecDbl");
            }
            throw e;
        }
        try {
            FfiConverterTypeTimeIntervalSecFlt.checkType(timeIntervalSecFlt)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("timeIntervalSecFlt");
            }
            throw e;
        }
        /**
         * @type {Url}
         */
        this.url = url;
        /**
         * @type {Handle}
         */
        this.handle = handle;
        /**
         * @type {TimeIntervalMs}
         */
        this.timeIntervalMs = timeIntervalMs;
        /**
         * @type {TimeIntervalSecDbl}
         */
        this.timeIntervalSecDbl = timeIntervalSecDbl;
        /**
         * @type {TimeIntervalSecFlt}
         */
        this.timeIntervalSecFlt = timeIntervalSecFlt;
    }

    equals(other) {
        return (
            this.url == other.url
            && this.handle == other.handle
            && this.timeIntervalMs == other.timeIntervalMs
            && this.timeIntervalSecDbl == other.timeIntervalSecDbl
            && this.timeIntervalSecFlt == other.timeIntervalSecFlt
        )
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeCustomTypesDemo extends FfiConverterArrayBuffer {
    static read(dataStream) {
        return new CustomTypesDemo({
            url: FfiConverterTypeUrl.read(dataStream),
            handle: FfiConverterTypeHandle.read(dataStream),
            timeIntervalMs: FfiConverterTypeTimeIntervalMs.read(dataStream),
            timeIntervalSecDbl: FfiConverterTypeTimeIntervalSecDbl.read(dataStream),
            timeIntervalSecFlt: FfiConverterTypeTimeIntervalSecFlt.read(dataStream),
        });
    }
    static write(dataStream, value) {
        FfiConverterTypeUrl.write(dataStream, value.url);
        FfiConverterTypeHandle.write(dataStream, value.handle);
        FfiConverterTypeTimeIntervalMs.write(dataStream, value.timeIntervalMs);
        FfiConverterTypeTimeIntervalSecDbl.write(dataStream, value.timeIntervalSecDbl);
        FfiConverterTypeTimeIntervalSecFlt.write(dataStream, value.timeIntervalSecFlt);
    }

    static computeSize(value) {
        let totalSize = 0;
        totalSize += FfiConverterTypeUrl.computeSize(value.url);
        totalSize += FfiConverterTypeHandle.computeSize(value.handle);
        totalSize += FfiConverterTypeTimeIntervalMs.computeSize(value.timeIntervalMs);
        totalSize += FfiConverterTypeTimeIntervalSecDbl.computeSize(value.timeIntervalSecDbl);
        totalSize += FfiConverterTypeTimeIntervalSecFlt.computeSize(value.timeIntervalSecFlt);
        return totalSize
    }

    static checkType(value) {
        super.checkType(value);
        if (!(value instanceof CustomTypesDemo)) {
            throw new UniFFITypeError(`Expected 'CustomTypesDemo', found '${typeof value}'`);
        }
        try {
            FfiConverterTypeUrl.checkType(value.url);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".url");
            }
            throw e;
        }
        try {
            FfiConverterTypeHandle.checkType(value.handle);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".handle");
            }
            throw e;
        }
        try {
            FfiConverterTypeTimeIntervalMs.checkType(value.timeIntervalMs);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".timeIntervalMs");
            }
            throw e;
        }
        try {
            FfiConverterTypeTimeIntervalSecDbl.checkType(value.timeIntervalSecDbl);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".timeIntervalSecDbl");
            }
            throw e;
        }
        try {
            FfiConverterTypeTimeIntervalSecFlt.checkType(value.timeIntervalSecFlt);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".timeIntervalSecFlt");
            }
            throw e;
        }
    }
}
/**
 * RecWithDefault
 */
export class RecWithDefault {
    constructor(
        {
            a= 42
        } = {
            a: undefined
        }
    ) {
        try {
            FfiConverterUInt8.checkType(a)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("a");
            }
            throw e;
        }
        /**
         * @type {number}
         */
        this.a = a;
    }

    equals(other) {
        return (
            this.a == other.a
        )
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeRecWithDefault extends FfiConverterArrayBuffer {
    static read(dataStream) {
        return new RecWithDefault({
            a: FfiConverterUInt8.read(dataStream),
        });
    }
    static write(dataStream, value) {
        FfiConverterUInt8.write(dataStream, value.a);
    }

    static computeSize(value) {
        let totalSize = 0;
        totalSize += FfiConverterUInt8.computeSize(value.a);
        return totalSize
    }

    static checkType(value) {
        super.checkType(value);
        if (!(value instanceof RecWithDefault)) {
            throw new UniFFITypeError(`Expected 'RecWithDefault', found '${typeof value}'`);
        }
        try {
            FfiConverterUInt8.checkType(value.a);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".a");
            }
            throw e;
        }
    }
}

/**
 * TestInterfaceInterface
 */
export class TestInterfaceInterface {
    /**
     * getValue
     * @returns {number}
     */
    getValue() {
      throw Error("getValue not implemented");
    }
    /**
     * Get the current reference count for this object
     * 
     * The count does not include the extra reference needed to call this method.
     * @returns {number}
     */
    refCount() {
      throw Error("refCount not implemented");
    }

}

/**
 * TestInterface
 */
export class TestInterface extends TestInterfaceInterface {
    // Use `init` to instantiate this class.
    // DO NOT USE THIS CONSTRUCTOR DIRECTLY
    constructor(opts) {
        super();
        if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) {
            throw new UniFFIError("Attempting to construct an int using the JavaScript constructor directly" +
            "Please use a UDL defined constructor, or the init function for the primary constructor")
        }
        if (!(opts[constructUniffiObject] instanceof UniFFIPointer)) {
            throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer")
        }
        this[uniffiObjectPtr] = opts[constructUniffiObject];
    }
    /**
     * init
     * @param {number} value
     * @returns {TestInterface}
     */
    static init(
        value) {
       
        if (value instanceof UniffiSkipJsTypeCheck) {
            value = value.value;
        } else {
            FfiConverterUInt32.checkType(value);
        }
        const result = UniFFIScaffolding.callSync(
            330, // uniffi_uniffi_bindings_tests_fn_constructor_testinterface_new
            FfiConverterUInt32.lower(value),
        )
        return handleRustResult(
            result,
            FfiConverterTypeTestInterface.lift.bind(FfiConverterTypeTestInterface),
            null,
        )
    }

    /**
     * getValue
     * @returns {number}
     */
    getValue() {
       
        const result = UniFFIScaffolding.callSync(
            331, // uniffi_uniffi_bindings_tests_fn_method_testinterface_get_value
            FfiConverterTypeTestInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            FfiConverterUInt32.lift.bind(FfiConverterUInt32),
            null,
        )
    }

    /**
     * Get the current reference count for this object
     * 
     * The count does not include the extra reference needed to call this method.
     * @returns {number}
     */
    refCount() {
       
        const result = UniFFIScaffolding.callSync(
            332, // uniffi_uniffi_bindings_tests_fn_method_testinterface_ref_count
            FfiConverterTypeTestInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            FfiConverterUInt32.lift.bind(FfiConverterUInt32),
            null,
        )
    }

}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTestInterface extends FfiConverter {
    static lift(value) {
        const opts = {};
        opts[constructUniffiObject] = value;
        return new TestInterface(opts);
    }

    static lower(value) {
        const ptr = value[uniffiObjectPtr];
        if (!(ptr instanceof UniFFIPointer)) {
            throw new UniFFITypeError("Object is not a 'TestInterface' instance");
        }
        return ptr;
    }

    static lowerReceiver(value) {
        // This works exactly the same as lower for non-trait interfaces
        return this.lower(value);
    }

    static read(dataStream) {
        return this.lift(dataStream.readPointer(29));
    }

    static write(dataStream, value) {
        dataStream.writePointer(29, this.lower(value));
    }

    static computeSize(value) {
        return 8;
    }
}

/**
 * TwoTestInterfaces
 */
export class TwoTestInterfaces {
    constructor(
        {
            first, 
            second
        } = {
            first: undefined, 
            second: undefined
        }
    ) {
        try {
            FfiConverterTypeTestInterface.checkType(first)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("first");
            }
            throw e;
        }
        try {
            FfiConverterTypeTestInterface.checkType(second)
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart("second");
            }
            throw e;
        }
        /**
         * @type {TestInterface}
         */
        this.first = first;
        /**
         * @type {TestInterface}
         */
        this.second = second;
    }

    equals(other) {
        return (
            this.first == other.first
            && this.second == other.second
        )
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTwoTestInterfaces extends FfiConverterArrayBuffer {
    static read(dataStream) {
        return new TwoTestInterfaces({
            first: FfiConverterTypeTestInterface.read(dataStream),
            second: FfiConverterTypeTestInterface.read(dataStream),
        });
    }
    static write(dataStream, value) {
        FfiConverterTypeTestInterface.write(dataStream, value.first);
        FfiConverterTypeTestInterface.write(dataStream, value.second);
    }

    static computeSize(value) {
        let totalSize = 0;
        totalSize += FfiConverterTypeTestInterface.computeSize(value.first);
        totalSize += FfiConverterTypeTestInterface.computeSize(value.second);
        return totalSize
    }

    static checkType(value) {
        super.checkType(value);
        if (!(value instanceof TwoTestInterfaces)) {
            throw new UniFFITypeError(`Expected 'TwoTestInterfaces', found '${typeof value}'`);
        }
        try {
            FfiConverterTypeTestInterface.checkType(value.first);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".first");
            }
            throw e;
        }
        try {
            FfiConverterTypeTestInterface.checkType(value.second);
        } catch (e) {
            if (e instanceof UniFFITypeError) {
                e.addItemDescriptionPart(".second");
            }
            throw e;
        }
    }
}

/**
 * EnumNoData
 */
export const EnumNoData = Object.freeze({
    /**
     * A
     */
    A: 0,
    /**
     * B
     */
    B: 1,
    /**
     * C
     */
    C: 2,
});

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeEnumNoData extends FfiConverterArrayBuffer {
    static #validValues = Object.values(EnumNoData)

    static read(dataStream) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        switch (dataStream.readInt32()) {
            case 1:
                return EnumNoData.A
            case 2:
                return EnumNoData.B
            case 3:
                return EnumNoData.C
            default:
                throw new UniFFITypeError("Unknown EnumNoData variant");
        }
    }

    static write(dataStream, value) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        if (value === EnumNoData.A) {
            dataStream.writeInt32(1);
            return;
        }
        if (value === EnumNoData.B) {
            dataStream.writeInt32(2);
            return;
        }
        if (value === EnumNoData.C) {
            dataStream.writeInt32(3);
            return;
        }
        throw new UniFFITypeError("Unknown EnumNoData variant");
    }

    static computeSize(value) {
        return 4;
    }

    static checkType(value) {
      // Check that the value is a valid enum variant
      if (!this.#validValues.includes(value)) {
          throw new UniFFITypeError(`${value} is not a valid value for EnumNoData`);
      }
    }
}

/**
 * EnumWithData
 */
export class EnumWithData {}
/**
 * A
 */
EnumWithData.A = class extends EnumWithData{
   constructor({value = undefined } = {}) {
                super();
            try {
                FfiConverterUInt8.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("value");
                }
                throw e;
            }
            this.value = value;
    }
}
/**
 * B
 */
EnumWithData.B = class extends EnumWithData{
   constructor({value = undefined } = {}) {
                super();
            try {
                FfiConverterString.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("value");
                }
                throw e;
            }
            this.value = value;
    }
}
/**
 * C
 */
EnumWithData.C = class extends EnumWithData{
   constructor() {
            super();
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeEnumWithData extends FfiConverterArrayBuffer {
    static read(dataStream) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        switch (dataStream.readInt32()) {
            case 1:
                return new EnumWithData.A({
                    value: FfiConverterUInt8.read(dataStream)
                });
            case 2:
                return new EnumWithData.B({
                    value: FfiConverterString.read(dataStream)
                });
            case 3:
                return new EnumWithData.C();
            default:
                throw new UniFFITypeError("Unknown EnumWithData variant");
        }
    }

    static write(dataStream, value) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        if (value instanceof EnumWithData.A) {
            dataStream.writeInt32(1);
            FfiConverterUInt8.write(dataStream, value.value);
            return;
        }
        if (value instanceof EnumWithData.B) {
            dataStream.writeInt32(2);
            FfiConverterString.write(dataStream, value.value);
            return;
        }
        if (value instanceof EnumWithData.C) {
            dataStream.writeInt32(3);
            return;
        }
        throw new UniFFITypeError("Unknown EnumWithData variant");
    }

    static computeSize(value) {
        // Size of the Int indicating the variant
        let totalSize = 4;
        if (value instanceof EnumWithData.A) {
            totalSize += FfiConverterUInt8.computeSize(value.value);
            return totalSize;
        }
        if (value instanceof EnumWithData.B) {
            totalSize += FfiConverterString.computeSize(value.value);
            return totalSize;
        }
        if (value instanceof EnumWithData.C) {
            return totalSize;
        }
        throw new UniFFITypeError("Unknown EnumWithData variant");
    }

    static checkType(value) {
      if (!(value instanceof EnumWithData)) {
        throw new UniFFITypeError(`${value} is not a subclass instance of EnumWithData`);
      }
    }
}

/**
 * ComplexEnum
 */
export class ComplexEnum {}
/**
 * A
 */
ComplexEnum.A = class extends ComplexEnum{
   constructor({value = undefined } = {}) {
                super();
            try {
                FfiConverterTypeEnumNoData.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("value");
                }
                throw e;
            }
            this.value = value;
    }
}
/**
 * B
 */
ComplexEnum.B = class extends ComplexEnum{
   constructor({value = undefined } = {}) {
                super();
            try {
                FfiConverterTypeEnumWithData.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("value");
                }
                throw e;
            }
            this.value = value;
    }
}
/**
 * C
 */
ComplexEnum.C = class extends ComplexEnum{
   constructor({value = undefined } = {}) {
                super();
            try {
                FfiConverterTypeSimpleRec.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("value");
                }
                throw e;
            }
            this.value = value;
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeComplexEnum extends FfiConverterArrayBuffer {
    static read(dataStream) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        switch (dataStream.readInt32()) {
            case 1:
                return new ComplexEnum.A({
                    value: FfiConverterTypeEnumNoData.read(dataStream)
                });
            case 2:
                return new ComplexEnum.B({
                    value: FfiConverterTypeEnumWithData.read(dataStream)
                });
            case 3:
                return new ComplexEnum.C({
                    value: FfiConverterTypeSimpleRec.read(dataStream)
                });
            default:
                throw new UniFFITypeError("Unknown ComplexEnum variant");
        }
    }

    static write(dataStream, value) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        if (value instanceof ComplexEnum.A) {
            dataStream.writeInt32(1);
            FfiConverterTypeEnumNoData.write(dataStream, value.value);
            return;
        }
        if (value instanceof ComplexEnum.B) {
            dataStream.writeInt32(2);
            FfiConverterTypeEnumWithData.write(dataStream, value.value);
            return;
        }
        if (value instanceof ComplexEnum.C) {
            dataStream.writeInt32(3);
            FfiConverterTypeSimpleRec.write(dataStream, value.value);
            return;
        }
        throw new UniFFITypeError("Unknown ComplexEnum variant");
    }

    static computeSize(value) {
        // Size of the Int indicating the variant
        let totalSize = 4;
        if (value instanceof ComplexEnum.A) {
            totalSize += FfiConverterTypeEnumNoData.computeSize(value.value);
            return totalSize;
        }
        if (value instanceof ComplexEnum.B) {
            totalSize += FfiConverterTypeEnumWithData.computeSize(value.value);
            return totalSize;
        }
        if (value instanceof ComplexEnum.C) {
            totalSize += FfiConverterTypeSimpleRec.computeSize(value.value);
            return totalSize;
        }
        throw new UniFFITypeError("Unknown ComplexEnum variant");
    }

    static checkType(value) {
      if (!(value instanceof ComplexEnum)) {
        throw new UniFFITypeError(`${value} is not a subclass instance of ComplexEnum`);
      }
    }
}

/**
 * ExplicitValuedEnum
 */
export const ExplicitValuedEnum = Object.freeze({
    /**
     * FIRST
     */
    FIRST: 1,
    /**
     * SECOND
     */
    SECOND: 2,
    /**
     * FOURTH
     */
    FOURTH: 4,
    /**
     * TENTH
     */
    TENTH: 10,
    /**
     * ELEVENTH
     */
    ELEVENTH: 11,
    /**
     * THIRTEENTH
     */
    THIRTEENTH: 13,
});

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeExplicitValuedEnum extends FfiConverterArrayBuffer {
    static #validValues = Object.values(ExplicitValuedEnum)

    static read(dataStream) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        switch (dataStream.readInt32()) {
            case 1:
                return ExplicitValuedEnum.FIRST
            case 2:
                return ExplicitValuedEnum.SECOND
            case 3:
                return ExplicitValuedEnum.FOURTH
            case 4:
                return ExplicitValuedEnum.TENTH
            case 5:
                return ExplicitValuedEnum.ELEVENTH
            case 6:
                return ExplicitValuedEnum.THIRTEENTH
            default:
                throw new UniFFITypeError("Unknown ExplicitValuedEnum variant");
        }
    }

    static write(dataStream, value) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        if (value === ExplicitValuedEnum.FIRST) {
            dataStream.writeInt32(1);
            return;
        }
        if (value === ExplicitValuedEnum.SECOND) {
            dataStream.writeInt32(2);
            return;
        }
        if (value === ExplicitValuedEnum.FOURTH) {
            dataStream.writeInt32(3);
            return;
        }
        if (value === ExplicitValuedEnum.TENTH) {
            dataStream.writeInt32(4);
            return;
        }
        if (value === ExplicitValuedEnum.ELEVENTH) {
            dataStream.writeInt32(5);
            return;
        }
        if (value === ExplicitValuedEnum.THIRTEENTH) {
            dataStream.writeInt32(6);
            return;
        }
        throw new UniFFITypeError("Unknown ExplicitValuedEnum variant");
    }

    static computeSize(value) {
        return 4;
    }

    static checkType(value) {
      // Check that the value is a valid enum variant
      if (!this.#validValues.includes(value)) {
          throw new UniFFITypeError(`${value} is not a valid value for ExplicitValuedEnum`);
      }
    }
}

/**
 * GappedEnum
 */
export const GappedEnum = Object.freeze({
    /**
     * ONE
     */
    ONE: 10,
    /**
     * TWO
     */
    TWO: 11,
    /**
     * THREE
     */
    THREE: 14,
});

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeGappedEnum extends FfiConverterArrayBuffer {
    static #validValues = Object.values(GappedEnum)

    static read(dataStream) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        switch (dataStream.readInt32()) {
            case 1:
                return GappedEnum.ONE
            case 2:
                return GappedEnum.TWO
            case 3:
                return GappedEnum.THREE
            default:
                throw new UniFFITypeError("Unknown GappedEnum variant");
        }
    }

    static write(dataStream, value) {
        // Use sequential indices (1-based) for the wire format to match the Rust scaffolding
        if (value === GappedEnum.ONE) {
            dataStream.writeInt32(1);
            return;
        }
        if (value === GappedEnum.TWO) {
            dataStream.writeInt32(2);
            return;
        }
        if (value === GappedEnum.THREE) {
            dataStream.writeInt32(3);
            return;
        }
        throw new UniFFITypeError("Unknown GappedEnum variant");
    }

    static computeSize(value) {
        return 4;
    }

    static checkType(value) {
      // Check that the value is a valid enum variant
      if (!this.#validValues.includes(value)) {
          throw new UniFFITypeError(`${value} is not a valid value for GappedEnum`);
      }
    }
}

/**
 * Error enum
 */
export class TestError extends Error {}


/**
 * Failure1
 */
export class Failure1 extends TestError {

    constructor(
        ...params
    ) {
        super(...params);
    }
    toString() {
        return `Failure1: ${super.toString()}`
    }
}

/**
 * Failure2
 */
export class Failure2 extends TestError {

    constructor(
        data,
        ...params
    ) {
        const message = `data: ${ data }`;
        super(message, ...params);
        this.data = data;
    }
    toString() {
        return `Failure2: ${super.toString()}`
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTestError extends FfiConverterArrayBuffer {
    static read(dataStream) {
        switch (dataStream.readInt32()) {
            case 1:
                return new Failure1(
                    );
            case 2:
                return new Failure2(
                    FfiConverterString.read(dataStream)
                    );
            default:
                throw new UniFFITypeError("Unknown TestError variant");
        }
    }
    static computeSize(value) {
        // Size of the Int indicating the variant
        let totalSize = 4;
        if (value instanceof Failure1) {
            return totalSize;
        }
        if (value instanceof Failure2) {
            totalSize += FfiConverterString.computeSize(value.data);
            return totalSize;
        }
        throw new UniFFITypeError("Unknown TestError variant");
    }
    static write(dataStream, value) {
        if (value instanceof Failure1) {
            dataStream.writeInt32(1);
            return;
        }
        if (value instanceof Failure2) {
            dataStream.writeInt32(2);
            FfiConverterString.write(dataStream, value.data);
            return;
        }
        throw new UniFFITypeError("Unknown TestError variant");
    }

    static errorClass = TestError;
}

/**
 * Flat error enum
 * 
 * The associated data for this won't be across the FFI.  Flat errors are mostly just a historical
 * artifact, but there are some use-cases for them -- for example variants that wrap errors from
 * other crates.
 */
export class TestFlatError extends Error {}


/**
 * Here's an example of a variant that only works with a flat error, `io::Error` is not
 * UniFFI compatible and can't be passed across the FFI.
 */
export class IoError extends TestFlatError {

    constructor(message, ...params) {
        super(...params);
        this.message = message;
    }
    toString() {
        return `IoError: ${super.toString()}`
    }
}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTestFlatError extends FfiConverterArrayBuffer {
    static read(dataStream) {
        switch (dataStream.readInt32()) {
            case 1:
                return new IoError(FfiConverterString.read(dataStream));
            default:
                throw new UniFFITypeError("Unknown TestFlatError variant");
        }
    }
    static computeSize(value) {
        // Size of the Int indicating the variant
        let totalSize = 4;
        if (value instanceof IoError) {
            return totalSize;
        }
        throw new UniFFITypeError("Unknown TestFlatError variant");
    }
    static write(dataStream, value) {
        if (value instanceof IoError) {
            dataStream.writeInt32(1);
            return;
        }
        throw new UniFFITypeError("Unknown TestFlatError variant");
    }

    static errorClass = TestFlatError;
}

/**
 * AsyncInterfaceInterface
 */
export class AsyncInterfaceInterface {
    /**
     * name
     * @returns {Promise<string>}}
     */
    async name() {
      throw Error("name not implemented");
    }

}

/**
 * AsyncInterface
 */
export class AsyncInterface extends AsyncInterfaceInterface {
    // Use `init` to instantiate this class.
    // DO NOT USE THIS CONSTRUCTOR DIRECTLY
    constructor(opts) {
        super();
        if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) {
            throw new UniFFIError("Attempting to construct an int using the JavaScript constructor directly" +
            "Please use a UDL defined constructor, or the init function for the primary constructor")
        }
        if (!(opts[constructUniffiObject] instanceof UniFFIPointer)) {
            throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer")
        }
        this[uniffiObjectPtr] = opts[constructUniffiObject];
    }
    /**
     * init
     * @param {string} name
     * @returns {AsyncInterface}
     */
    static init(
        name) {
       
        if (name instanceof UniffiSkipJsTypeCheck) {
            name = name.value;
        } else {
            FfiConverterString.checkType(name);
        }
        const result = UniFFIScaffolding.callSync(
            333, // uniffi_uniffi_bindings_tests_fn_constructor_asyncinterface_new
            FfiConverterString.lower(name),
        )
        return handleRustResult(
            result,
            FfiConverterTypeAsyncInterface.lift.bind(FfiConverterTypeAsyncInterface),
            null,
        )
    }

    /**
     * name
     * @returns {Promise<string>}}
     */
    async name() {
       
        const result = await UniFFIScaffolding.callAsync(
            334, // uniffi_uniffi_bindings_tests_fn_method_asyncinterface_name
            FfiConverterTypeAsyncInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            FfiConverterString.lift.bind(FfiConverterString),
            null,
        )
    }

}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeAsyncInterface extends FfiConverter {
    static lift(value) {
        const opts = {};
        opts[constructUniffiObject] = value;
        return new AsyncInterface(opts);
    }

    static lower(value) {
        const ptr = value[uniffiObjectPtr];
        if (!(ptr instanceof UniFFIPointer)) {
            throw new UniFFITypeError("Object is not a 'AsyncInterface' instance");
        }
        return ptr;
    }

    static lowerReceiver(value) {
        // This works exactly the same as lower for non-trait interfaces
        return this.lower(value);
    }

    static read(dataStream) {
        return this.lift(dataStream.readPointer(30));
    }

    static write(dataStream, value) {
        dataStream.writePointer(30, this.lower(value));
    }

    static computeSize(value) {
        return 8;
    }
}


/**
 * Async version of `TestTraitInterface`
 */
export class AsyncTestTraitInterface {
    /**
     * No-op function, this tests if that we can make calls at all
     */
    async noop() {
      throw Error("noop not implemented");
    }
    /**
     * Get the internal value
     * @returns {Promise<number>}}
     */
    async getValue() {
      throw Error("getValue not implemented");
    }
    /**
     * Set the internal value
     * @param {number} value
     */
    async setValue(
        value) {
      throw Error("setValue not implemented");
    }
    /**
     * Method aimed at maximizing the complexity
     * 
     * This should return an error if `numbers.a == numbers.b` otherwise it should return numbers back
     * unchanged.
     * @param {CallbackInterfaceNumbers} numbers
     * @returns {Promise<CallbackInterfaceNumbers>}}
     */
    async throwIfEqual(
        numbers) {
      throw Error("throwIfEqual not implemented");
    }

}

/**
 * Async version of `TestTraitInterface`
 */
export class AsyncTestTraitInterfaceImpl extends AsyncTestTraitInterface {
    // Use `init` to instantiate this class.
    // DO NOT USE THIS CONSTRUCTOR DIRECTLY
    constructor(opts) {
        super();
        if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) {
            throw new UniFFIError("Attempting to construct an int using the JavaScript constructor directly" +
            "Please use a UDL defined constructor, or the init function for the primary constructor")
        }
        if (!(opts[constructUniffiObject] instanceof UniFFIPointer)) {
            throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer")
        }
        this[uniffiObjectPtr] = opts[constructUniffiObject];
    }

    /**
     * No-op function, this tests if that we can make calls at all
     */
    async noop() {
       
        const result = await UniFFIScaffolding.callAsync(
            335, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_noop
            FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            (result) => undefined,
            null,
        )
    }

    /**
     * Get the internal value
     * @returns {Promise<number>}}
     */
    async getValue() {
       
        const result = await UniFFIScaffolding.callAsync(
            336, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_get_value
            FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            FfiConverterUInt32.lift.bind(FfiConverterUInt32),
            null,
        )
    }

    /**
     * Set the internal value
     * @param {number} value
     */
    async setValue(
        value) {
       
        if (value instanceof UniffiSkipJsTypeCheck) {
            value = value.value;
        } else {
            FfiConverterUInt32.checkType(value);
        }
        const result = await UniFFIScaffolding.callAsync(
            337, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_set_value
            FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this),
            FfiConverterUInt32.lower(value),
        )
        return handleRustResult(
            result,
            (result) => undefined,
            null,
        )
    }

    /**
     * Method aimed at maximizing the complexity
     * 
     * This should return an error if `numbers.a == numbers.b` otherwise it should return numbers back
     * unchanged.
     * @param {CallbackInterfaceNumbers} numbers
     * @returns {Promise<CallbackInterfaceNumbers>}}
     */
    async throwIfEqual(
        numbers) {
       
        if (numbers instanceof UniffiSkipJsTypeCheck) {
            numbers = numbers.value;
        } else {
            FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers);
        }
        const result = await UniFFIScaffolding.callAsync(
            338, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_throw_if_equal
            FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this),
            FfiConverterTypeCallbackInterfaceNumbers.lower(numbers),
        )
        return handleRustResult(
            result,
            FfiConverterTypeCallbackInterfaceNumbers.lift.bind(FfiConverterTypeCallbackInterfaceNumbers),
            FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
        )
    }

}

// FfiConverter for a trait interface.  This is a hybrid of the FFIConverter regular interfaces and
// for callback interfaces.
//
// Export the FFIConverter object to make external types work.
export class FfiConverterTypeAsyncTestTraitInterface extends FfiConverter {
    static lift(handle) {
        if (handle instanceof UniFFIPointer) {
          // Rust handle.  Construct an object from it
          const opts = {};
          opts[constructUniffiObject] = handle;
          return new AsyncTestTraitInterfaceImpl(opts);
        } else {
          // JS handle.  Get the JS object from the callback handler
          return uniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface.takeCallbackObj(handle)
        }
    }

    static lower(value) {
        const ptr = value[uniffiObjectPtr];
        if (ptr instanceof UniFFIPointer) {
          // Rust-implemented interface, return the ptr.  The C++ code will clone it.
          return ptr;
        } else {
          // JS-implemented interface, store the object in the handle map and return the handle
          if (!(value instanceof AsyncTestTraitInterface)) {
              throw new UniFFITypeError("expected 'AsyncTestTraitInterface' subclass");
          }
          return uniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface.storeCallbackObj(value)
        }
    }

    // lowerReceiver is used when calling methods on an interface we got from Rust, 
    // it treats value like a regular interface.
    static lowerReceiver(value) {
        const ptr = value[uniffiObjectPtr];
        if (!(ptr instanceof UniFFIPointer)) {
            throw new UniFFITypeError("Object is not a 'AsyncTestTraitInterfaceImpl' instance");
        }
        return ptr;
    }

    static read(dataStream) {
        return this.lift(dataStream.readHandleOrPointer(31))
    }

    static write(dataStream, value) {
        if (value[uniffiObjectPtr] instanceof UniFFIPointer) {
          // Rust-implemented interface, return the ptr.
          dataStream.writePointer(31, this.lower(value));
        } else {
          dataStream.writeInt64(this.lower(value))
        }
    }

    static computeSize(value) {
        return 8;
    }
}

const uniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface = new UniFFICallbackHandler(
    "AsyncTestTraitInterface",
    11,
    [
        new UniFFICallbackMethodHandler(
            "noop",
            [
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "getValue",
            [
            ],
            FfiConverterUInt32.lower.bind(FfiConverterUInt32),
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "setValue",
            [
                FfiConverterUInt32,
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "throwIfEqual",
            [
                FfiConverterTypeCallbackInterfaceNumbers,
            ],
            FfiConverterTypeCallbackInterfaceNumbers.lower.bind(FfiConverterTypeCallbackInterfaceNumbers),
            (e) => {
              if (e instanceof TestError) {
                return FfiConverterTypeTestError.lower(e);
              }
              throw e;
            }
        ),
    ]
);

// Allow the shutdown-related functionality to be tested in the unit tests
UnitTestObjs.uniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface = uniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface;

/**
 * ComplexMethodsInterface
 */
export class ComplexMethodsInterface {
    /**
     * methodWithDefault
     * @param {string} arg
     * @returns {string}
     */
    methodWithDefault(
        arg = "DEFAULT") {
      throw Error("methodWithDefault not implemented");
    }
    /**
     * methodWithMultiWordArg
     * @param {string} theArgument
     * @returns {string}
     */
    methodWithMultiWordArg(
        theArgument) {
      throw Error("methodWithMultiWordArg not implemented");
    }

}

/**
 * ComplexMethods
 */
export class ComplexMethods extends ComplexMethodsInterface {
    // Use `init` to instantiate this class.
    // DO NOT USE THIS CONSTRUCTOR DIRECTLY
    constructor(opts) {
        super();
        if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) {
            throw new UniFFIError("Attempting to construct an int using the JavaScript constructor directly" +
            "Please use a UDL defined constructor, or the init function for the primary constructor")
        }
        if (!(opts[constructUniffiObject] instanceof UniFFIPointer)) {
            throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer")
        }
        this[uniffiObjectPtr] = opts[constructUniffiObject];
    }
    /**
     * init
     * @returns {ComplexMethods}
     */
    static init() {
       
        const result = UniFFIScaffolding.callSync(
            339, // uniffi_uniffi_bindings_tests_fn_constructor_complexmethods_new
        )
        return handleRustResult(
            result,
            FfiConverterTypeComplexMethods.lift.bind(FfiConverterTypeComplexMethods),
            null,
        )
    }

    /**
     * methodWithDefault
     * @param {string} arg
     * @returns {string}
     */
    methodWithDefault(
        arg = "DEFAULT") {
       
        if (arg instanceof UniffiSkipJsTypeCheck) {
            arg = arg.value;
        } else {
            FfiConverterString.checkType(arg);
        }
        const result = UniFFIScaffolding.callSync(
            340, // uniffi_uniffi_bindings_tests_fn_method_complexmethods_method_with_default
            FfiConverterTypeComplexMethods.lowerReceiver(this),
            FfiConverterString.lower(arg),
        )
        return handleRustResult(
            result,
            FfiConverterString.lift.bind(FfiConverterString),
            null,
        )
    }

    /**
     * methodWithMultiWordArg
     * @param {string} theArgument
     * @returns {string}
     */
    methodWithMultiWordArg(
        theArgument) {
       
        if (theArgument instanceof UniffiSkipJsTypeCheck) {
            theArgument = theArgument.value;
        } else {
            FfiConverterString.checkType(theArgument);
        }
        const result = UniFFIScaffolding.callSync(
            341, // uniffi_uniffi_bindings_tests_fn_method_complexmethods_method_with_multi_word_arg
            FfiConverterTypeComplexMethods.lowerReceiver(this),
            FfiConverterString.lower(theArgument),
        )
        return handleRustResult(
            result,
            FfiConverterString.lift.bind(FfiConverterString),
            null,
        )
    }

}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeComplexMethods extends FfiConverter {
    static lift(value) {
        const opts = {};
        opts[constructUniffiObject] = value;
        return new ComplexMethods(opts);
    }

    static lower(value) {
        const ptr = value[uniffiObjectPtr];
        if (!(ptr instanceof UniFFIPointer)) {
            throw new UniFFITypeError("Object is not a 'ComplexMethods' instance");
        }
        return ptr;
    }

    static lowerReceiver(value) {
        // This works exactly the same as lower for non-trait interfaces
        return this.lower(value);
    }

    static read(dataStream) {
        return this.lift(dataStream.readPointer(32));
    }

    static write(dataStream, value) {
        dataStream.writePointer(32, this.lower(value));
    }

    static computeSize(value) {
        return 8;
    }
}


/**
 * TestTraitInterface
 */
export class TestTraitInterface {
    /**
     * No-op function, this tests if that we can make calls at all
     */
    noop() {
      throw Error("noop not implemented");
    }
    /**
     * Get the internal value
     * @returns {number}
     */
    getValue() {
      throw Error("getValue not implemented");
    }
    /**
     * Set the internal value
     * @param {number} value
     */
    setValue(
        value) {
      throw Error("setValue not implemented");
    }
    /**
     * Method aimed at maximizing the complexity
     * 
     * This should return an error if `numbers.a == numbers.b` otherwise it should return numbers back
     * unchanged.
     * @param {CallbackInterfaceNumbers} numbers
     * @returns {CallbackInterfaceNumbers}
     */
    throwIfEqual(
        numbers) {
      throw Error("throwIfEqual not implemented");
    }

}

/**
 * TestTraitInterface
 */
export class TestTraitInterfaceImpl extends TestTraitInterface {
    // Use `init` to instantiate this class.
    // DO NOT USE THIS CONSTRUCTOR DIRECTLY
    constructor(opts) {
        super();
        if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) {
            throw new UniFFIError("Attempting to construct an int using the JavaScript constructor directly" +
            "Please use a UDL defined constructor, or the init function for the primary constructor")
        }
        if (!(opts[constructUniffiObject] instanceof UniFFIPointer)) {
            throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer")
        }
        this[uniffiObjectPtr] = opts[constructUniffiObject];
    }

    /**
     * No-op function, this tests if that we can make calls at all
     */
    noop() {
       
        const result = UniFFIScaffolding.callSync(
            342, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_noop
            FfiConverterTypeTestTraitInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            (result) => undefined,
            null,
        )
    }

    /**
     * Get the internal value
     * @returns {number}
     */
    getValue() {
       
        const result = UniFFIScaffolding.callSync(
            343, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_get_value
            FfiConverterTypeTestTraitInterface.lowerReceiver(this),
        )
        return handleRustResult(
            result,
            FfiConverterUInt32.lift.bind(FfiConverterUInt32),
            null,
        )
    }

    /**
     * Set the internal value
     * @param {number} value
     */
    setValue(
        value) {
       
        if (value instanceof UniffiSkipJsTypeCheck) {
            value = value.value;
        } else {
            FfiConverterUInt32.checkType(value);
        }
        const result = UniFFIScaffolding.callSync(
            344, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_set_value
            FfiConverterTypeTestTraitInterface.lowerReceiver(this),
            FfiConverterUInt32.lower(value),
        )
        return handleRustResult(
            result,
            (result) => undefined,
            null,
        )
    }

    /**
     * Method aimed at maximizing the complexity
     * 
     * This should return an error if `numbers.a == numbers.b` otherwise it should return numbers back
     * unchanged.
     * @param {CallbackInterfaceNumbers} numbers
     * @returns {CallbackInterfaceNumbers}
     */
    throwIfEqual(
        numbers) {
       
        if (numbers instanceof UniffiSkipJsTypeCheck) {
            numbers = numbers.value;
        } else {
            FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers);
        }
        const result = UniFFIScaffolding.callSync(
            345, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_throw_if_equal
            FfiConverterTypeTestTraitInterface.lowerReceiver(this),
            FfiConverterTypeCallbackInterfaceNumbers.lower(numbers),
        )
        return handleRustResult(
            result,
            FfiConverterTypeCallbackInterfaceNumbers.lift.bind(FfiConverterTypeCallbackInterfaceNumbers),
            FfiConverterTypeTestError.lift.bind(FfiConverterTypeTestError),
        )
    }

}

// FfiConverter for a trait interface.  This is a hybrid of the FFIConverter regular interfaces and
// for callback interfaces.
//
// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTestTraitInterface extends FfiConverter {
    static lift(handle) {
        if (handle instanceof UniFFIPointer) {
          // Rust handle.  Construct an object from it
          const opts = {};
          opts[constructUniffiObject] = handle;
          return new TestTraitInterfaceImpl(opts);
        } else {
          // JS handle.  Get the JS object from the callback handler
          return uniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface.takeCallbackObj(handle)
        }
    }

    static lower(value) {
        const ptr = value[uniffiObjectPtr];
        if (ptr instanceof UniFFIPointer) {
          // Rust-implemented interface, return the ptr.  The C++ code will clone it.
          return ptr;
        } else {
          // JS-implemented interface, store the object in the handle map and return the handle
          if (!(value instanceof TestTraitInterface)) {
              throw new UniFFITypeError("expected 'TestTraitInterface' subclass");
          }
          return uniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface.storeCallbackObj(value)
        }
    }

    // lowerReceiver is used when calling methods on an interface we got from Rust, 
    // it treats value like a regular interface.
    static lowerReceiver(value) {
        const ptr = value[uniffiObjectPtr];
        if (!(ptr instanceof UniFFIPointer)) {
            throw new UniFFITypeError("Object is not a 'TestTraitInterfaceImpl' instance");
        }
        return ptr;
    }

    static read(dataStream) {
        return this.lift(dataStream.readHandleOrPointer(33))
    }

    static write(dataStream, value) {
        if (value[uniffiObjectPtr] instanceof UniFFIPointer) {
          // Rust-implemented interface, return the ptr.
          dataStream.writePointer(33, this.lower(value));
        } else {
          dataStream.writeInt64(this.lower(value))
        }
    }

    static computeSize(value) {
        return 8;
    }
}

const uniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface = new UniFFICallbackHandler(
    "TestTraitInterface",
    12,
    [
        new UniFFICallbackMethodHandler(
            "noop",
            [
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "getValue",
            [
            ],
            FfiConverterUInt32.lower.bind(FfiConverterUInt32),
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "setValue",
            [
                FfiConverterUInt32,
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "throwIfEqual",
            [
                FfiConverterTypeCallbackInterfaceNumbers,
            ],
            FfiConverterTypeCallbackInterfaceNumbers.lower.bind(FfiConverterTypeCallbackInterfaceNumbers),
            (e) => {
              if (e instanceof TestError) {
                return FfiConverterTypeTestError.lower(e);
              }
              throw e;
            }
        ),
    ]
);

// Allow the shutdown-related functionality to be tested in the unit tests
UnitTestObjs.uniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface = uniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface;

/**
 * Async version of `TestCallbackInterface`
 */
export class TestAsyncCallbackInterface {
    /**
     * noop
     */
    async noop() {
      throw Error("noop not implemented");
    }
    /**
     * getValue
     * @returns {Promise<number>}}
     */
    async getValue() {
      throw Error("getValue not implemented");
    }
    /**
     * setValue
     * @param {number} value
     */
    async setValue(
        value) {
      throw Error("setValue not implemented");
    }
    /**
     * throwIfEqual
     * @param {CallbackInterfaceNumbers} numbers
     * @returns {Promise<CallbackInterfaceNumbers>}}
     */
    async throwIfEqual(
        numbers) {
      throw Error("throwIfEqual not implemented");
    }

}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTestAsyncCallbackInterface extends FfiConverter {
    static lower(callbackObj) {
        if (!(callbackObj instanceof TestAsyncCallbackInterface)) {
            throw new UniFFITypeError("expected 'TestAsyncCallbackInterface' subclass");
        }
        return uniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface.storeCallbackObj(callbackObj)
    }

    static lift(handleId) {
        return uniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface.takeCallbackObj(handleId)
    }

    static read(dataStream) {
        return this.lift(dataStream.readInt64())
    }

    static write(dataStream, callbackObj) {
        dataStream.writeInt64(this.lower(callbackObj))
    }

    static computeSize(callbackObj) {
        return 8;
    }
}
const uniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface = new UniFFICallbackHandler(
    "TestAsyncCallbackInterface",
    9,
    [
        new UniFFICallbackMethodHandler(
            "noop",
            [
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "getValue",
            [
            ],
            FfiConverterUInt32.lower.bind(FfiConverterUInt32),
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "setValue",
            [
                FfiConverterUInt32,
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "throwIfEqual",
            [
                FfiConverterTypeCallbackInterfaceNumbers,
            ],
            FfiConverterTypeCallbackInterfaceNumbers.lower.bind(FfiConverterTypeCallbackInterfaceNumbers),
            (e) => {
              if (e instanceof TestError) {
                return FfiConverterTypeTestError.lower(e);
              }
              throw e;
            }
        ),
    ]
);

// Allow the shutdown-related functionality to be tested in the unit tests
UnitTestObjs.uniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface = uniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface;

/**
 * TestCallbackInterface
 */
export class TestCallbackInterface {
    /**
     * noop
     */
    noop() {
      throw Error("noop not implemented");
    }
    /**
     * getValue
     * @returns {number}
     */
    getValue() {
      throw Error("getValue not implemented");
    }
    /**
     * setValue
     * @param {number} value
     */
    setValue(
        value) {
      throw Error("setValue not implemented");
    }
    /**
     * throwIfEqual
     * @param {CallbackInterfaceNumbers} numbers
     * @returns {CallbackInterfaceNumbers}
     */
    throwIfEqual(
        numbers) {
      throw Error("throwIfEqual not implemented");
    }

}

// Export the FFIConverter object to make external types work.
export class FfiConverterTypeTestCallbackInterface extends FfiConverter {
    static lower(callbackObj) {
        if (!(callbackObj instanceof TestCallbackInterface)) {
            throw new UniFFITypeError("expected 'TestCallbackInterface' subclass");
        }
        return uniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface.storeCallbackObj(callbackObj)
    }

    static lift(handleId) {
        return uniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface.takeCallbackObj(handleId)
    }

    static read(dataStream) {
        return this.lift(dataStream.readInt64())
    }

    static write(dataStream, callbackObj) {
        dataStream.writeInt64(this.lower(callbackObj))
    }

    static computeSize(callbackObj) {
        return 8;
    }
}
const uniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface = new UniFFICallbackHandler(
    "TestCallbackInterface",
    10,
    [
        new UniFFICallbackMethodHandler(
            "noop",
            [
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "getValue",
            [
            ],
            FfiConverterUInt32.lower.bind(FfiConverterUInt32),
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "setValue",
            [
                FfiConverterUInt32,
            ],
            (result) => undefined,
            (e) => {
              throw e;
            }
        ),
        new UniFFICallbackMethodHandler(
            "throwIfEqual",
            [
                FfiConverterTypeCallbackInterfaceNumbers,
            ],
            FfiConverterTypeCallbackInterfaceNumbers.lower.bind(FfiConverterTypeCallbackInterfaceNumbers),
            (e) => {
              if (e instanceof TestError) {
                return FfiConverterTypeTestError.lower(e);
              }
              throw e;
            }
        ),
    ]
);

// Allow the shutdown-related functionality to be tested in the unit tests
UnitTestObjs.uniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface = uniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface;
// Export the FFIConverter object to make external types work.
export class FfiConverterMapStringString extends FfiConverterArrayBuffer {
    static read(dataStream) {
        const len = dataStream.readInt32();
        const map = new Map();
        for (let i = 0; i < len; i++) {
            const key = FfiConverterString.read(dataStream);
            const value = FfiConverterString.read(dataStream);
            map.set(key, value);
        }

        return map;
    }

     static write(dataStream, map) {
        dataStream.writeInt32(map.size);
        for (const [key, value] of map) {
            FfiConverterString.write(dataStream, key);
            FfiConverterString.write(dataStream, value);
        }
    }

    static computeSize(map) {
        // The size of the length
        let size = 4;
        for (const [key, value] of map) {
            size += FfiConverterString.computeSize(key);
            size += FfiConverterString.computeSize(value);
        }
        return size;
    }

    static checkType(map) {
        for (const [key, value] of map) {
            try {
                FfiConverterString.checkType(key);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("(key)");
                }
                throw e;
            }

            try {
                FfiConverterString.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart(`[${key}]`);
                }
                throw e;
            }
        }
    }
}
// Export the FFIConverter object to make external types work.
export class FfiConverterSequenceUInt32 extends FfiConverterArrayBuffer {
    static read(dataStream) {
        const len = dataStream.readInt32();
        const arr = [];
        for (let i = 0; i < len; i++) {
            arr.push(FfiConverterUInt32.read(dataStream));
        }
        return arr;
    }

    static write(dataStream, value) {
        dataStream.writeInt32(value.length);
        value.forEach((innerValue) => {
            FfiConverterUInt32.write(dataStream, innerValue);
        })
    }

    static computeSize(value) {
        // The size of the length
        let size = 4;
        for (const innerValue of value) {
            size += FfiConverterUInt32.computeSize(innerValue);
        }
        return size;
    }

    static checkType(value) {
        if (!Array.isArray(value)) {
            throw new UniFFITypeError(`${value} is not an array`);
        }
        value.forEach((innerValue, idx) => {
            try {
                FfiConverterUInt32.checkType(innerValue);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart(`[${idx}]`);
                }
                throw e;
            }
        })
    }
}
// Export the FFIConverter object to make external types work.
export class FfiConverterSequenceTypeAsyncTestTraitInterface extends FfiConverterArrayBuffer {
    static read(dataStream) {
        const len = dataStream.readInt32();
        const arr = [];
        for (let i = 0; i < len; i++) {
            arr.push(FfiConverterTypeAsyncTestTraitInterface.read(dataStream));
        }
        return arr;
    }

    static write(dataStream, value) {
        dataStream.writeInt32(value.length);
        value.forEach((innerValue) => {
            FfiConverterTypeAsyncTestTraitInterface.write(dataStream, innerValue);
        })
    }

    static computeSize(value) {
        // The size of the length
        let size = 4;
        for (const innerValue of value) {
            size += FfiConverterTypeAsyncTestTraitInterface.computeSize(innerValue);
        }
        return size;
    }

    static checkType(value) {
        if (!Array.isArray(value)) {
            throw new UniFFITypeError(`${value} is not an array`);
        }
        value.forEach((innerValue, idx) => {
            try {
                FfiConverterTypeAsyncTestTraitInterface.checkType(innerValue);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart(`[${idx}]`);
                }
                throw e;
            }
        })
    }
}


// Export the FFIConverter object to make external types work.
export class FfiConverterMapStringUInt32 extends FfiConverterArrayBuffer {
    static read(dataStream) {
        const len = dataStream.readInt32();
        const map = new Map();
        for (let i = 0; i < len; i++) {
            const key = FfiConverterString.read(dataStream);
            const value = FfiConverterUInt32.read(dataStream);
            map.set(key, value);
        }

        return map;
    }

     static write(dataStream, map) {
        dataStream.writeInt32(map.size);
        for (const [key, value] of map) {
            FfiConverterString.write(dataStream, key);
            FfiConverterUInt32.write(dataStream, value);
        }
    }

    static computeSize(map) {
        // The size of the length
        let size = 4;
        for (const [key, value] of map) {
            size += FfiConverterString.computeSize(key);
            size += FfiConverterUInt32.computeSize(value);
        }
        return size;
    }

    static checkType(map) {
        for (const [key, value] of map) {
            try {
                FfiConverterString.checkType(key);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart("(key)");
                }
                throw e;
            }

            try {
                FfiConverterUInt32.checkType(value);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart(`[${key}]`);
                }
                throw e;
            }
        }
    }
}
// Export the FFIConverter object to make external types work.
export class FfiConverterSequenceMapStringUInt32 extends FfiConverterArrayBuffer {
    static read(dataStream) {
        const len = dataStream.readInt32();
        const arr = [];
        for (let i = 0; i < len; i++) {
            arr.push(FfiConverterMapStringUInt32.read(dataStream));
        }
        return arr;
    }

    static write(dataStream, value) {
        dataStream.writeInt32(value.length);
        value.forEach((innerValue) => {
            FfiConverterMapStringUInt32.write(dataStream, innerValue);
        })
    }

    static computeSize(value) {
        // The size of the length
        let size = 4;
        for (const innerValue of value) {
            size += FfiConverterMapStringUInt32.computeSize(innerValue);
        }
        return size;
    }

    static checkType(value) {
        if (!Array.isArray(value)) {
            throw new UniFFITypeError(`${value} is not an array`);
        }
        value.forEach((innerValue, idx) => {
            try {
                FfiConverterMapStringUInt32.checkType(innerValue);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart(`[${idx}]`);
                }
                throw e;
            }
        })
    }
}
// Export the FFIConverter object to make external types work.
export class FfiConverterOptionalSequenceMapStringUInt32 extends FfiConverterArrayBuffer {
    static checkType(value) {
        if (value !== undefined && value !== null) {
            FfiConverterSequenceMapStringUInt32.checkType(value)
        }
    }

    static read(dataStream) {
        const code = dataStream.readUint8(0);
        switch (code) {
            case 0:
                return null
            case 1:
                return FfiConverterSequenceMapStringUInt32.read(dataStream)
            default:
                throw new UniFFIError(`Unexpected code: ${code}`);
        }
    }

    static write(dataStream, value) {
        if (value === null || value === undefined) {
            dataStream.writeUint8(0);
            return;
        }
        dataStream.writeUint8(1);
        FfiConverterSequenceMapStringUInt32.write(dataStream, value)
    }

    static computeSize(value) {
        if (value === null || value === undefined) {
            return 1;
        }
        return 1 + FfiConverterSequenceMapStringUInt32.computeSize(value)
    }
}
// Export the FFIConverter object to make external types work.
export class FfiConverterOptionalUInt32 extends FfiConverterArrayBuffer {
    static checkType(value) {
        if (value !== undefined && value !== null) {
            FfiConverterUInt32.checkType(value)
        }
    }

    static read(dataStream) {
        const code = dataStream.readUint8(0);
        switch (code) {
            case 0:
                return null
            case 1:
                return FfiConverterUInt32.read(dataStream)
            default:
                throw new UniFFIError(`Unexpected code: ${code}`);
        }
    }

    static write(dataStream, value) {
        if (value === null || value === undefined) {
            dataStream.writeUint8(0);
            return;
        }
        dataStream.writeUint8(1);
        FfiConverterUInt32.write(dataStream, value)
    }

    static computeSize(value) {
        if (value === null || value === undefined) {
            return 1;
        }
        return 1 + FfiConverterUInt32.computeSize(value)
    }
}
// Export the FFIConverter object to make external types work.
export class FfiConverterSequenceTypeTestTraitInterface extends FfiConverterArrayBuffer {
    static read(dataStream) {
        const len = dataStream.readInt32();
        const arr = [];
        for (let i = 0; i < len; i++) {
            arr.push(FfiConverterTypeTestTraitInterface.read(dataStream));
        }
        return arr;
    }

    static write(dataStream, value) {
        dataStream.writeInt32(value.length);
        value.forEach((innerValue) => {
            FfiConverterTypeTestTraitInterface.write(dataStream, innerValue);
        })
    }

    static computeSize(value) {
        // The size of the length
        let size = 4;
        for (const innerValue of value) {
            size += FfiConverterTypeTestTraitInterface.computeSize(innerValue);
        }
        return size;
    }

    static checkType(value) {
        if (!Array.isArray(value)) {
            throw new UniFFITypeError(`${value} is not an array`);
        }
        value.forEach((innerValue, idx) => {
            try {
                FfiConverterTypeTestTraitInterface.checkType(innerValue);
            } catch (e) {
                if (e instanceof UniFFITypeError) {
                    e.addItemDescriptionPart(`[${idx}]`);
                }
                throw e;
            }
        })
    }
}
// Wrapper to skip type checking for function arguments
//
// This is only defined and used on test fixtures.  The goal is to skip the JS type checking so that
// we can test the lower-level C++ type checking.
export class UniffiSkipJsTypeCheck {
    constructor(value) {
        this.value = value;
    }
}
