+ bindings_instance?: bindings.{struct_name};
+
+ constructor(ptr?: number, arg?: bindings.{struct_name}{constructor_arguments}) {{
+ if (Number.isFinite(ptr)) {{
+ super(ptr, bindings.{struct_name.replace("LDK","")}_free);
+ this.bindings_instance = null;
+ }} else {{
+ // TODO: private constructor instantiation
+ super(bindings.{struct_name}_new(arg{super_instantiator}));
+ this.ptrs_to.push(arg);
+ {pointer_to_adder}
+ }}
+ }}
+
+ static new_impl(arg: {struct_name.replace("LDK", "")}Interface{impl_constructor_arguments}): {struct_name.replace("LDK", "")} {{
+ const impl_holder: {struct_name}Holder = new {struct_name}Holder();
+ let structImplementation = <bindings.{struct_name}>{{
+ // todo: in-line interface filling
+ {out_interface_implementation_overrides}
+ }};
+ impl_holder.held = new {struct_name.replace("LDK", "")} (null, structImplementation{trait_constructor_arguments});
+ }}
+
+ export interface {struct_name.replace("LDK", "")}Interface {{
+ {out_java_interface}
+ }}
+
+ class {struct_name}Holder {{
+ held: {struct_name.replace("LDK", "")};
+ }}