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_CVec_u8ZPeerHandleErrorZ extends CommonBase {
10 private Result_CVec_u8ZPeerHandleErrorZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_CVec_u8ZPeerHandleErrorZ_free(ptr); } super.finalize();
15 static Result_CVec_u8ZPeerHandleErrorZ constr_from_ptr(long ptr) {
16 if (bindings.LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(ptr)) {
17 return new Result_CVec_u8ZPeerHandleErrorZ_OK(null, ptr);
19 return new Result_CVec_u8ZPeerHandleErrorZ_Err(null, ptr);
22 public static final class Result_CVec_u8ZPeerHandleErrorZ_OK extends Result_CVec_u8ZPeerHandleErrorZ {
23 public final byte[] res;
24 private Result_CVec_u8ZPeerHandleErrorZ_OK(Object _dummy, long ptr) {
26 this.res = bindings.LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(ptr);
28 public Result_CVec_u8ZPeerHandleErrorZ_OK(byte[] res) {
29 this(null, bindings.CResult_CVec_u8ZPeerHandleErrorZ_ok(res));
33 public static final class Result_CVec_u8ZPeerHandleErrorZ_Err extends Result_CVec_u8ZPeerHandleErrorZ {
34 public final PeerHandleError err;
35 private Result_CVec_u8ZPeerHandleErrorZ_Err(Object _dummy, long ptr) {
37 long err = bindings.LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(ptr);
38 PeerHandleError err_hu_conv = new PeerHandleError(null, err);
39 this.err = err_hu_conv;
41 public Result_CVec_u8ZPeerHandleErrorZ_Err(PeerHandleError err) {
42 this(null, bindings.CResult_CVec_u8ZPeerHandleErrorZ_err(err == null ? 0 : err.ptr & ~1));
43 this.ptrs_to.add(err);