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_boolLightningErrorZ extends CommonBase {
10 private Result_boolLightningErrorZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_boolLightningErrorZ_free(ptr); } super.finalize();
15 static Result_boolLightningErrorZ constr_from_ptr(long ptr) {
16 if (bindings.LDKCResult_boolLightningErrorZ_result_ok(ptr)) {
17 return new Result_boolLightningErrorZ_OK(null, ptr);
19 return new Result_boolLightningErrorZ_Err(null, ptr);
22 public static final class Result_boolLightningErrorZ_OK extends Result_boolLightningErrorZ {
23 public final boolean res;
24 private Result_boolLightningErrorZ_OK(Object _dummy, long ptr) {
26 this.res = bindings.LDKCResult_boolLightningErrorZ_get_ok(ptr);
28 public Result_boolLightningErrorZ_OK(boolean res) {
29 this(null, bindings.CResult_boolLightningErrorZ_ok(res));
33 public static final class Result_boolLightningErrorZ_Err extends Result_boolLightningErrorZ {
34 public final LightningError err;
35 private Result_boolLightningErrorZ_Err(Object _dummy, long ptr) {
37 long err = bindings.LDKCResult_boolLightningErrorZ_get_err(ptr);
38 LightningError err_hu_conv = new LightningError(null, err);
39 this.err = err_hu_conv;
41 public Result_boolLightningErrorZ_Err(LightningError err) {
42 this(null, bindings.CResult_boolLightningErrorZ_err(err == null ? 0 : err.ptr & ~1));
43 this.ptrs_to.add(err);