1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
9 public class Result_FundingSignedDecodeErrorZ extends CommonBase {
10 private Result_FundingSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_FundingSignedDecodeErrorZ_free(ptr); } super.finalize();
15 static Result_FundingSignedDecodeErrorZ constr_from_ptr(long ptr) {
16 if (bindings.LDKCResult_FundingSignedDecodeErrorZ_result_ok(ptr)) {
17 return new Result_FundingSignedDecodeErrorZ_OK(null, ptr);
19 return new Result_FundingSignedDecodeErrorZ_Err(null, ptr);
22 public static final class Result_FundingSignedDecodeErrorZ_OK extends Result_FundingSignedDecodeErrorZ {
23 public final FundingSigned res;
24 private Result_FundingSignedDecodeErrorZ_OK(Object _dummy, long ptr) {
26 long res = bindings.LDKCResult_FundingSignedDecodeErrorZ_get_ok(ptr);
27 FundingSigned res_hu_conv = new FundingSigned(null, res);
28 res_hu_conv.ptrs_to.add(this);
29 this.res = res_hu_conv;
33 public static final class Result_FundingSignedDecodeErrorZ_Err extends Result_FundingSignedDecodeErrorZ {
34 public final DecodeError err;
35 private Result_FundingSignedDecodeErrorZ_Err(Object _dummy, long ptr) {
37 long err = bindings.LDKCResult_FundingSignedDecodeErrorZ_get_err(ptr);
38 DecodeError err_hu_conv = new DecodeError(null, err);
39 err_hu_conv.ptrs_to.add(this);
40 this.err = err_hu_conv;
45 * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
47 public static Result_FundingSignedDecodeErrorZ ok(FundingSigned o) {
48 long ret = bindings.CResult_FundingSignedDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
49 if (ret < 1024) { return null; }
50 Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret);
51 ret_hu_conv.ptrs_to.add(o);
56 * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
58 public static Result_FundingSignedDecodeErrorZ err(DecodeError e) {
59 long ret = bindings.CResult_FundingSignedDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
60 if (ret < 1024) { return null; }
61 Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret);
62 ret_hu_conv.ptrs_to.add(e);
67 * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
68 * but with all dynamically-allocated buffers duplicated in new buffers.
70 public Result_FundingSignedDecodeErrorZ clone() {
71 long ret = bindings.CResult_FundingSignedDecodeErrorZ_clone(this.ptr);
72 if (ret < 1024) { return null; }
73 Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret);