1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class Result_NonePeerHandleErrorZ extends CommonBase {
10 private Result_NonePeerHandleErrorZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_NonePeerHandleErrorZ_free(ptr); } super.finalize();
15 static Result_NonePeerHandleErrorZ constr_from_ptr(long ptr) {
16 if (bindings.LDKCResult_NonePeerHandleErrorZ_result_ok(ptr)) {
17 return new Result_NonePeerHandleErrorZ_OK(null, ptr);
19 return new Result_NonePeerHandleErrorZ_Err(null, ptr);
22 public static final class Result_NonePeerHandleErrorZ_OK extends Result_NonePeerHandleErrorZ {
23 public final byte res;
24 private Result_NonePeerHandleErrorZ_OK(Object _dummy, long ptr) {
26 this.res = bindings.LDKCResult_NonePeerHandleErrorZ_get_ok(ptr);
28 public Result_NonePeerHandleErrorZ_OK() {
29 this(null, bindings.CResult_NonePeerHandleErrorZ_ok());
33 public static final class Result_NonePeerHandleErrorZ_Err extends Result_NonePeerHandleErrorZ {
34 public final PeerHandleError err;
35 private Result_NonePeerHandleErrorZ_Err(Object _dummy, long ptr) {
37 long err = bindings.LDKCResult_NonePeerHandleErrorZ_get_err(ptr);
38 PeerHandleError err_hu_conv = new PeerHandleError(null, err);
39 this.err = err_hu_conv;
41 public Result_NonePeerHandleErrorZ_Err(PeerHandleError err) {
42 this(null, bindings.CResult_NonePeerHandleErrorZ_err(err == null ? 0 : err.ptr & ~1));
43 this.ptrs_to.add(err);