1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonBase {
9 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(Object _dummy, long ptr) { super(ptr); }
10 protected void finalize() throws Throwable {
11 if (ptr != 0) { bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(ptr); } super.finalize();
14 static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constr_from_ptr(long ptr) {
15 if (bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(ptr)) {
16 return new Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK(null, ptr);
18 return new Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err(null, ptr);
21 public static final class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK extends Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
22 public final TwoTuple<byte[], ChannelMonitor>[] res;
23 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK(Object _dummy, long ptr) {
25 long[] res = bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(ptr);
26 TwoTuple<byte[], ChannelMonitor>[] res_conv_34_arr = new TwoTuple[res.length];
27 for (int i = 0; i < res.length; i++) {
28 long res_conv_34 = res[i];
29 byte[] res_conv_34_a = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_a(res_conv_34);
30 long res_conv_34_b = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_b(res_conv_34);
31 ChannelMonitor res_conv_34_b_hu_conv = new ChannelMonitor(null, res_conv_34_b);
32 res_conv_34_b_hu_conv.ptrs_to.add(this);;
33 TwoTuple<byte[], ChannelMonitor> res_conv_34_conv = new TwoTuple<byte[], ChannelMonitor>(res_conv_34_a, res_conv_34_b_hu_conv, () -> {
34 bindings.C2Tuple_BlockHashChannelMonitorZ_free(res_conv_34);
36 res_conv_34_b_hu_conv.ptrs_to.add(res_conv_34_conv);
37 res_conv_34_arr[i] = res_conv_34_conv;
39 this.res = res_conv_34_arr;
43 public static final class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err extends Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
44 public final LDKIOError err;
45 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err(Object _dummy, long ptr) {
47 this.err = bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(ptr);
52 * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
54 public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constructor_ok(TwoTuple<byte[], ChannelMonitor>[] o) {
55 long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(Arrays.stream(o).mapToLong(o_conv_34 -> bindings.C2Tuple_BlockHashChannelMonitorZ_new(o_conv_34.a, o_conv_34.b == null ? 0 : o_conv_34.b.ptr & ~1)).toArray());
56 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
57 /* TODO 2 TwoTuple<byte[], ChannelMonitor> */;
62 * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
64 public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constructor_err(LDKIOError e) {
65 long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e);
66 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);