to_hu_conv = self.consts.var_decl_statement(ty_info.java_hu_ty, ty_info.var_name + "_hu_conv", "new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ")") + ";" + to_hu_conv_sfx,
to_hu_conv_name = ty_info.var_name + "_hu_conv", from_hu_conv = from_hu_conv)
- # The manually-defined types - TxOut and u5
+ # The manually-defined types - TxOut, u5, and Error
+ if ty_info.rust_obj == "LDKError":
+ assert from_hu_conv is None
+ return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,
+ arg_conv = "", arg_conv_name = "(LDKError){ ._dummy = 0 }", arg_conv_cleanup = None,
+ ret_conv = ("/*", "*/"), ret_conv_name = "0",
+ to_hu_conv = self.consts.var_decl_statement(ty_info.java_hu_ty, ty_info.var_name + "_conv", "new " + ty_info.java_hu_ty + "(" + ty_info.var_name + ")") + ";",
+ to_hu_conv_name = ty_info.var_name + "_conv", from_hu_conv = ("0", ""))
+
if ty_info.rust_obj == "LDKu5":
assert from_hu_conv is None
return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,
fn_arg = fn_arg[6:].strip()
arr_access = "chars"
arr_len = "len"
+ elif fn_arg.startswith("LDKError ") or fn_arg == "LDKError":
+ java_ty = consts.c_type_map['uint32_t'][0]
+ java_hu_ty = "UnqualifiedError"
+ rust_obj = "LDKError"
+ c_ty = "int32_t"
+ arr_ty = "uint32_t"
+ fn_ty_arg = "I"
+ fn_arg = fn_arg[8:].strip()
else:
ma = var_ty_regex.match(fn_arg)
arr_ty = ma.group(1).strip()
--- /dev/null
+package org.ldk.util;
+
+/**
+ * An type for cases where no additional information is available.
+ * In general, if you've gotten this far the cause of the error should already be clear.
+ */
+public class UnqualifiedError {
+ public UnqualifiedError(int _dummy) {}
+}
return this.val;
}
}
+
+export class UnqualifiedError {
+ public constructor(val: number) {}
+}
"""
self.txout_defn = """export class TxOut extends CommonBase {
}"""
self.hu_struct_file_prefix = """
-import { CommonBase, UInt5 } from './CommonBase.mjs';
+import { CommonBase, UInt5, UnqualifiedError } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
"""