if needs_full_clone and (ty_info.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns:
base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(" + ty_info.var_name + ");"
else:
- base_conv = base_conv + "\nif (" + ty_info.var_name + "_conv.free == " + ty_info.rust_obj + "_JCalls_free) {\n"
- base_conv = base_conv + "\t// If this_arg is a JCalls struct, then we need to increment the refcnt in it.\n"
- base_conv = base_conv + "\t" + ty_info.rust_obj + "_JCalls_clone(" + ty_info.var_name + "_conv.this_arg);\n}"
+ base_conv = base_conv + self.consts.trait_struct_inc_refcnt(ty_info)
if needs_full_clone:
base_conv = base_conv + "// Warning: we may need a move here but can't do a full clone!\n"
elif fn_arg.startswith("uint16_t"):
mapped_type = consts.c_type_map['uint16_t']
java_ty = mapped_type[0]
- c_ty = "jshort"
+ c_ty = "int16_t"
fn_ty_arg = "S"
fn_arg = fn_arg[8:].strip()
is_primitive = True
return (out_java, out_java_trait, out_c)
+ def trait_struct_inc_refcnt(self, ty_info):
+ base_conv = "\nif (" + ty_info.var_name + "_conv.free == " + ty_info.rust_obj + "_JCalls_free) {\n"
+ base_conv = base_conv + "\t// If this_arg is a JCalls struct, then we need to increment the refcnt in it.\n"
+ base_conv = base_conv + "\t" + ty_info.rust_obj + "_JCalls_clone(" + ty_info.var_name + "_conv.this_arg);\n}"
+ return base_conv
+
def map_complex_enum(self, struct_name, variant_list, camel_to_snake):
java_hu_type = struct_name.replace("LDK", "")
out_java_enum = ""
return (out_typescript_bindings, out_typescript_human, out_c)
+ def trait_struct_inc_refcnt(self, ty_info):
+ return ""
+
def map_complex_enum(self, struct_name, variant_list, camel_to_snake):
java_hu_type = struct_name.replace("LDK", "")