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_PaymentSecretAPIErrorZ extends CommonBase {
10 private Result_PaymentSecretAPIErrorZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_PaymentSecretAPIErrorZ_free(ptr); } super.finalize();
15 static Result_PaymentSecretAPIErrorZ constr_from_ptr(long ptr) {
16 if (bindings.LDKCResult_PaymentSecretAPIErrorZ_result_ok(ptr)) {
17 return new Result_PaymentSecretAPIErrorZ_OK(null, ptr);
19 return new Result_PaymentSecretAPIErrorZ_Err(null, ptr);
22 public static final class Result_PaymentSecretAPIErrorZ_OK extends Result_PaymentSecretAPIErrorZ {
23 public final byte[] res;
24 private Result_PaymentSecretAPIErrorZ_OK(Object _dummy, long ptr) {
26 this.res = bindings.LDKCResult_PaymentSecretAPIErrorZ_get_ok(ptr);
30 public static final class Result_PaymentSecretAPIErrorZ_Err extends Result_PaymentSecretAPIErrorZ {
31 public final APIError err;
32 private Result_PaymentSecretAPIErrorZ_Err(Object _dummy, long ptr) {
34 long err = bindings.LDKCResult_PaymentSecretAPIErrorZ_get_err(ptr);
35 APIError err_hu_conv = APIError.constr_from_ptr(err);
36 err_hu_conv.ptrs_to.add(this);
37 this.err = err_hu_conv;
42 * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
44 public static Result_PaymentSecretAPIErrorZ ok(byte[] o) {
45 long ret = bindings.CResult_PaymentSecretAPIErrorZ_ok(o);
46 if (ret < 1024) { return null; }
47 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
52 * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
54 public static Result_PaymentSecretAPIErrorZ err(APIError e) {
55 long ret = bindings.CResult_PaymentSecretAPIErrorZ_err(e.ptr);
56 if (ret < 1024) { return null; }
57 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
62 * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
63 * but with all dynamically-allocated buffers duplicated in new buffers.
65 public Result_PaymentSecretAPIErrorZ clone() {
66 long ret = bindings.CResult_PaymentSecretAPIErrorZ_clone(this.ptr);
67 if (ret < 1024) { return null; }
68 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);