Provide human versions of trait interfaces, with a bunch of fixes to make it work
[ldk-java] / src / main / java / org / ldk / structs / Result_NonePeerHandleErrorZ.java
index 385e571b5dd03c83fc6b250d9688953f85b36e61..c7b31e13e8df7304b19a78c9e0bd8137c5b3a938 100644 (file)
@@ -9,7 +9,7 @@ import java.util.Arrays;
 public class Result_NonePeerHandleErrorZ extends CommonBase {
        private Result_NonePeerHandleErrorZ(Object _dummy, long ptr) { super(ptr); }
        protected void finalize() throws Throwable {
-               bindings.CResult_NonePeerHandleErrorZ_free(ptr); super.finalize();
+               if (ptr != 0) { bindings.CResult_NonePeerHandleErrorZ_free(ptr); } super.finalize();
        }
 
        static Result_NonePeerHandleErrorZ constr_from_ptr(long ptr) {
@@ -20,20 +20,27 @@ public class Result_NonePeerHandleErrorZ extends CommonBase {
                }
        }
        public static final class Result_NonePeerHandleErrorZ_OK extends Result_NonePeerHandleErrorZ {
-               public byte res;
+               public final byte res;
                private Result_NonePeerHandleErrorZ_OK(Object _dummy, long ptr) {
                        super(_dummy, ptr);
                        this.res = bindings.LDKCResult_NonePeerHandleErrorZ_get_ok(ptr);
                }
-
+               public Result_NonePeerHandleErrorZ_OK() {
+                       this(null, bindings.CResult_NonePeerHandleErrorZ_ok());
+               }
        }
+
        public static final class Result_NonePeerHandleErrorZ_Err extends Result_NonePeerHandleErrorZ {
-               public PeerHandleError err;
+               public final PeerHandleError err;
                private Result_NonePeerHandleErrorZ_Err(Object _dummy, long ptr) {
                        super(_dummy, ptr);
                        long err = bindings.LDKCResult_NonePeerHandleErrorZ_get_err(ptr);
                        PeerHandleError err_hu_conv = new PeerHandleError(null, err);
                        this.err = err_hu_conv;
                }
+               public Result_NonePeerHandleErrorZ_Err(PeerHandleError err) {
+                       this(null, bindings.CResult_NonePeerHandleErrorZ_err(err == null ? 0 : err.ptr & ~1));
+                       this.ptrs_to.add(err);
+               }
        }
 }