1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
10 public class Result_ThirtyTwoBytesRetryableSendFailureZ extends CommonBase {
11 private Result_ThirtyTwoBytesRetryableSendFailureZ(Object _dummy, long ptr) { super(ptr); }
12 protected void finalize() throws Throwable {
13 if (ptr != 0) { bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_free(ptr); } super.finalize();
16 static Result_ThirtyTwoBytesRetryableSendFailureZ constr_from_ptr(long ptr) {
17 if (bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(ptr)) {
18 return new Result_ThirtyTwoBytesRetryableSendFailureZ_OK(null, ptr);
20 return new Result_ThirtyTwoBytesRetryableSendFailureZ_Err(null, ptr);
23 public static final class Result_ThirtyTwoBytesRetryableSendFailureZ_OK extends Result_ThirtyTwoBytesRetryableSendFailureZ {
24 public final byte[] res;
25 private Result_ThirtyTwoBytesRetryableSendFailureZ_OK(Object _dummy, long ptr) {
27 this.res = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(ptr);
31 public static final class Result_ThirtyTwoBytesRetryableSendFailureZ_Err extends Result_ThirtyTwoBytesRetryableSendFailureZ {
32 public final RetryableSendFailure err;
33 private Result_ThirtyTwoBytesRetryableSendFailureZ_Err(Object _dummy, long ptr) {
35 this.err = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(ptr);
40 * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
42 public static Result_ThirtyTwoBytesRetryableSendFailureZ ok(byte[] o) {
43 long ret = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(InternalUtils.check_arr_len(o, 32));
44 Reference.reachabilityFence(o);
45 if (ret >= 0 && ret <= 4096) { return null; }
46 Result_ThirtyTwoBytesRetryableSendFailureZ ret_hu_conv = Result_ThirtyTwoBytesRetryableSendFailureZ.constr_from_ptr(ret);
51 * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
53 public static Result_ThirtyTwoBytesRetryableSendFailureZ err(org.ldk.enums.RetryableSendFailure e) {
54 long ret = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e);
55 Reference.reachabilityFence(e);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 Result_ThirtyTwoBytesRetryableSendFailureZ ret_hu_conv = Result_ThirtyTwoBytesRetryableSendFailureZ.constr_from_ptr(ret);
62 * Checks if the given object is currently in the success state
64 public boolean is_ok() {
65 boolean ret = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(this.ptr);
66 Reference.reachabilityFence(this);
71 long ret = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(this.ptr);
72 Reference.reachabilityFence(this);
77 * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
78 * but with all dynamically-allocated buffers duplicated in new buffers.
80 public Result_ThirtyTwoBytesRetryableSendFailureZ clone() {
81 long ret = bindings.CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(this.ptr);
82 Reference.reachabilityFence(this);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 Result_ThirtyTwoBytesRetryableSendFailureZ ret_hu_conv = Result_ThirtyTwoBytesRetryableSendFailureZ.constr_from_ptr(ret);