- 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 + "("
- clone_ret_str = ""
- 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")) + " = " + "bindings." + self.tuple_types[ty_info.rust_obj][1] + "_get_" + chr(idx + ord("a")) + "(" + ty_info.var_name + ");\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 = from_hu_conv + "/*XXX: " + conv_map.from_hu_conv[1] + "*/"
- else:
- from_hu_conv = from_hu_conv + ty_info.var_name + "." + chr(idx + ord("a"))
-
- if conv.is_native_primitive:
- pass
- elif (conv_map.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns:
- accessor = ty_info.var_name + "_ref->" + chr(idx + ord("a"))
- clone_ret_str = clone_ret_str + "\n" + accessor + " = " + conv_map.rust_obj.replace("LDK", "") + "_clone(&" + accessor + ");"
+ 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"