- from_hu_conv_sfx = ""
- from_hu_conv = "bindings." + self.tuple_types[ty_info.rust_obj][1].replace("LDK", "") + "_new("
- to_hu_conv_pfx = ""
- to_hu_conv_sfx = ty_info.java_hu_ty + " " + ty_info.var_name + "_conv = new " + ty_info.java_hu_ty + "("
- for idx, conv in enumerate(self.tuple_types[ty_info.rust_obj][0]):
- if idx != 0:
- to_hu_conv_sfx = to_hu_conv_sfx + ", "
- from_hu_conv = from_hu_conv + ", "
- conv.var_name = ty_info.var_name + "_" + chr(idx + ord("a"))
- conv_map = self.map_type_with_info(conv, False, None, is_free, holds_ref)
- to_hu_conv_pfx = to_hu_conv_pfx + conv.java_ty + " " + ty_info.var_name + "_" + chr(idx + ord("a")) + " = "
- if not conv.is_native_primitive and (conv_map.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns and conv_map.rust_obj == "LDKTxOut":
- to_hu_conv_pfx = to_hu_conv_pfx + "bindings." + conv_map.rust_obj.replace("LDK", "") + "_clone("
- to_hu_conv_pfx = to_hu_conv_pfx + "bindings." + self.tuple_types[ty_info.rust_obj][1] + "_get_" + chr(idx + ord("a")) + "(" + ty_info.var_name + ")"
- if not conv.is_native_primitive and (conv_map.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns and conv_map.rust_obj == "LDKTxOut": # XXX
- to_hu_conv_pfx = to_hu_conv_pfx + ")"
- to_hu_conv_pfx = to_hu_conv_pfx + ";\n"
- if conv_map.to_hu_conv is not None:
- to_hu_conv_pfx = to_hu_conv_pfx + conv_map.to_hu_conv + ";\n"
- to_hu_conv_sfx = to_hu_conv_sfx + conv_map.to_hu_conv_name
- else:
- to_hu_conv_sfx = to_hu_conv_sfx + ty_info.var_name + "_" + chr(idx + ord("a"))
- if conv_map.from_hu_conv is not None:
- from_hu_conv = from_hu_conv + conv_map.from_hu_conv[0].replace(ty_info.var_name + "_" + chr(idx + ord("a")), ty_info.var_name + "." + chr(idx + ord("a")))
- if conv_map.from_hu_conv[1] != "":
- from_hu_conv_sfx = from_hu_conv_sfx + conv_map.from_hu_conv[1].replace(conv.var_name, ty_info.var_name + "." + chr(idx + ord("a")))
+ ret_conv_name = "((uint64_t)" + ty_info.var_name + "_conv)"
+ if holds_ref:
+ # If we're trying to return a ref, we have to clone.
+ if (ty_info.rust_obj.replace("LDK", "") + "_clone") not in self.clone_fns:
+ ret_conv = (ty_info.rust_obj + "* " + ty_info.var_name + "_conv = &", "")
+ ret_conv = (ret_conv[0], ";\n// Warning: we really need to clone here, but no clone is available for " + ty_info.rust_obj)
+ ret_conv_name += " | 1"