diff --git a/tool/src/kotlin/snapshots/diplomat_tool__kotlin__test__trait_gen.snap.new b/tool/src/kotlin/snapshots/diplomat_tool__kotlin__test__trait_gen.snap.new deleted file mode 100644 index 37840d448..000000000 --- a/tool/src/kotlin/snapshots/diplomat_tool__kotlin__test__trait_gen.snap.new +++ /dev/null @@ -1,175 +0,0 @@ ---- -source: tool/src/kotlin/mod.rs -assertion_line: 2426 -expression: result ---- -package dev.gigapixel.somelib - -import com.sun.jna.Callback -import com.sun.jna.Library -import com.sun.jna.Native -import com.sun.jna.Pointer -import com.sun.jna.Structure -/** Documentation for this trait! -*/ -interface TesterTrait { - /** Trait function docs - */ - fun testTraitFn(x: Int, y: Int, z: UByte): Int; - fun testVoidTraitFn(): Unit; - fun testStructTraitFn(s: TraitTestingStruct): Int; - fun testWithSlices(a: UByteArray, b: ShortArray): Int; - fun testStructReturn(): TraitTestingStruct; - fun testEnumReturn(): TraitTestingEnum; -} - - -internal interface Runner_DiplomatTraitMethod_TesterTrait_testTraitFn: Callback { - fun invoke(ignored: Pointer?, x: Int, y: Int, z: UByte ): Int -} -internal interface Runner_DiplomatTraitMethod_TesterTrait_testVoidTraitFn: Callback { - fun invoke(ignored: Pointer?): Unit -} -internal interface Runner_DiplomatTraitMethod_TesterTrait_testStructTraitFn: Callback { - fun invoke(ignored: Pointer?, s: TraitTestingStructNative ): Int -} -internal interface Runner_DiplomatTraitMethod_TesterTrait_testWithSlices: Callback { - fun invoke(ignored: Pointer?, a: Slice, b: Slice ): Int -} -internal interface Runner_DiplomatTraitMethod_TesterTrait_testStructReturn: Callback { - fun invoke(ignored: Pointer?): TraitTestingStructNative -} -internal interface Runner_DiplomatTraitMethod_TesterTrait_testEnumReturn: Callback { - fun invoke(ignored: Pointer?): Int -} - -internal object TesterTrait_VTable_destructor: Callback { - fun invoke(obj_pointer: Pointer) { - DiplomatJVMRuntime.dropRustCookie(obj_pointer); - } -}; - -internal class DiplomatTrait_TesterTrait_VTable_Native: Structure(), Structure.ByValue { - @JvmField - internal var destructor: Callback = TesterTrait_VTable_destructor; - @JvmField - internal var size: Pointer = Pointer(0L); - @JvmField - internal var alignment: Pointer = Pointer(0L); - - @JvmField - internal var run_testTraitFn_callback: Runner_DiplomatTraitMethod_TesterTrait_testTraitFn - = object : Runner_DiplomatTraitMethod_TesterTrait_testTraitFn { - override fun invoke(ignored: Pointer?, x: Int, y: Int, z: UByte ): Int { - throw Exception("ERROR NOT IMPLEMENTED") - } - } - @JvmField - internal var run_testVoidTraitFn_callback: Runner_DiplomatTraitMethod_TesterTrait_testVoidTraitFn - = object : Runner_DiplomatTraitMethod_TesterTrait_testVoidTraitFn { - override fun invoke(ignored: Pointer?): Unit { - throw Exception("ERROR NOT IMPLEMENTED") - } - } - @JvmField - internal var run_testStructTraitFn_callback: Runner_DiplomatTraitMethod_TesterTrait_testStructTraitFn - = object : Runner_DiplomatTraitMethod_TesterTrait_testStructTraitFn { - override fun invoke(ignored: Pointer?, s: TraitTestingStructNative ): Int { - throw Exception("ERROR NOT IMPLEMENTED") - } - } - @JvmField - internal var run_testWithSlices_callback: Runner_DiplomatTraitMethod_TesterTrait_testWithSlices - = object : Runner_DiplomatTraitMethod_TesterTrait_testWithSlices { - override fun invoke(ignored: Pointer?, a: Slice, b: Slice ): Int { - throw Exception("ERROR NOT IMPLEMENTED") - } - } - @JvmField - internal var run_testStructReturn_callback: Runner_DiplomatTraitMethod_TesterTrait_testStructReturn - = object : Runner_DiplomatTraitMethod_TesterTrait_testStructReturn { - override fun invoke(ignored: Pointer?): TraitTestingStructNative { - throw Exception("ERROR NOT IMPLEMENTED") - } - } - @JvmField - internal var run_testEnumReturn_callback: Runner_DiplomatTraitMethod_TesterTrait_testEnumReturn - = object : Runner_DiplomatTraitMethod_TesterTrait_testEnumReturn { - override fun invoke(ignored: Pointer?): Int { - throw Exception("ERROR NOT IMPLEMENTED") - } - } - // Define the fields of the struct - override fun getFieldOrder(): List { - return listOf("destructor", "size", "alignment", "run_testTraitFn_callback", "run_testVoidTraitFn_callback", "run_testStructTraitFn_callback", "run_testWithSlices_callback", "run_testStructReturn_callback", "run_testEnumReturn_callback") - } -} - -internal class DiplomatTrait_TesterTrait_Wrapper_Native: Structure(), Structure.ByValue { - @JvmField - internal var data_: Pointer = Pointer(0L); - @JvmField - internal var vtable: DiplomatTrait_TesterTrait_VTable_Native - = DiplomatTrait_TesterTrait_VTable_Native(); - - // Define the fields of the struct - override fun getFieldOrder(): List { - return listOf("data_", "vtable") - } -} - -internal class DiplomatTrait_TesterTrait_Wrapper internal constructor ( - internal val nativeStruct: DiplomatTrait_TesterTrait_Wrapper_Native) { - val data_: Pointer = nativeStruct.data_ - val vtable: DiplomatTrait_TesterTrait_VTable_Native = nativeStruct.vtable - - companion object { - val NATIVESIZE: Long = Native.getNativeSize(DiplomatTrait_TesterTrait_Wrapper_Native::class.java).toLong() - - fun fromTraitObj(trt_obj: TesterTrait): DiplomatTrait_TesterTrait_Wrapper { - val vtable = DiplomatTrait_TesterTrait_VTable_Native() - - - val testTraitFn: Runner_DiplomatTraitMethod_TesterTrait_testTraitFn = object : Runner_DiplomatTraitMethod_TesterTrait_testTraitFn { - override fun invoke(ignored: Pointer?, x: Int, y: Int, z: UByte ): Int { - return trt_obj.testTraitFn(x, y, z); - } - } - vtable.run_testTraitFn_callback = testTraitFn; - val testVoidTraitFn: Runner_DiplomatTraitMethod_TesterTrait_testVoidTraitFn = object : Runner_DiplomatTraitMethod_TesterTrait_testVoidTraitFn { - override fun invoke(ignored: Pointer?): Unit { - return trt_obj.testVoidTraitFn(); - } - } - vtable.run_testVoidTraitFn_callback = testVoidTraitFn; - val testStructTraitFn: Runner_DiplomatTraitMethod_TesterTrait_testStructTraitFn = object : Runner_DiplomatTraitMethod_TesterTrait_testStructTraitFn { - override fun invoke(ignored: Pointer?, s: TraitTestingStructNative ): Int { - return trt_obj.testStructTraitFn(TraitTestingStruct(s)); - } - } - vtable.run_testStructTraitFn_callback = testStructTraitFn; - val testWithSlices: Runner_DiplomatTraitMethod_TesterTrait_testWithSlices = object : Runner_DiplomatTraitMethod_TesterTrait_testWithSlices { - override fun invoke(ignored: Pointer?, a: Slice, b: Slice ): Int { - return trt_obj.testWithSlices(PrimitiveArrayTools.getUByteArray(a), PrimitiveArrayTools.getShortArray(b)); - } - } - vtable.run_testWithSlices_callback = testWithSlices; - val testStructReturn: Runner_DiplomatTraitMethod_TesterTrait_testStructReturn = object : Runner_DiplomatTraitMethod_TesterTrait_testStructReturn { - override fun invoke(ignored: Pointer?): TraitTestingStructNative { - return trt_obj.testStructReturn().nativeStruct; - } - } - vtable.run_testStructReturn_callback = testStructReturn; - val testEnumReturn: Runner_DiplomatTraitMethod_TesterTrait_testEnumReturn = object : Runner_DiplomatTraitMethod_TesterTrait_testEnumReturn { - override fun invoke(ignored: Pointer?): Int { - return trt_obj.testEnumReturn().toNative(); - } - } - vtable.run_testEnumReturn_callback = testEnumReturn; - val native_wrapper = DiplomatTrait_TesterTrait_Wrapper_Native(); - native_wrapper.vtable = vtable; - native_wrapper.data_ = DiplomatJVMRuntime.buildRustCookie(native_wrapper as Object); - return DiplomatTrait_TesterTrait_Wrapper(native_wrapper); - } - } -}