5daf871c08f0d42380f48b54dc9c8481cb6472b4
[ldk-java] / src / main / java / org / ldk / structs / Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonBase {
10         private Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(ptr); } super.finalize();
13         }
14
15         static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ constr_from_ptr(long ptr) {
16                 if (bindings.LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(ptr)) {
17                         return new Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(null, ptr);
18                 } else {
19                         return new Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK extends Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
23                 public final TwoTuple<byte[], ChannelMonitor> res;
24                 private Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         long res = bindings.LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(ptr);
27                         byte[] res_a = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_a(res);
28                         long res_b = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_b(res);
29                         ChannelMonitor res_b_hu_conv = new ChannelMonitor(null, res_b);
30                         res_b_hu_conv.ptrs_to.add(this);;
31                         TwoTuple<byte[], ChannelMonitor> res_conv = new TwoTuple<byte[], ChannelMonitor>(res_a, res_b_hu_conv, () -> {
32                                 bindings.C2Tuple_BlockHashChannelMonitorZ_free(res);
33                         });
34                         res_b_hu_conv.ptrs_to.add(res_conv);
35                         this.res = res_conv;
36                 }
37                 public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(TwoTuple<byte[], ChannelMonitor> res) {
38                         this(null, bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(bindings.C2Tuple_BlockHashChannelMonitorZ_new(res.a, res.b == null ? 0 : res.b.ptr & ~1)));
39                         this.ptrs_to.add(res.b);
40                 }
41         }
42
43         public static final class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err extends Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
44                 public final DecodeError err;
45                 private Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err(Object _dummy, long ptr) {
46                         super(_dummy, ptr);
47                         long err = bindings.LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(ptr);
48                         DecodeError err_hu_conv = new DecodeError(null, err);
49                         err_hu_conv.ptrs_to.add(this);
50                         this.err = err_hu_conv;
51                 }
52                 public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err(DecodeError err) {
53                         this(null, bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1));
54                         this.ptrs_to.add(err);
55                 }
56         }
57 }