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_PaymentSecretAPIErrorZ extends CommonBase {
9 private Result_PaymentSecretAPIErrorZ(Object _dummy, long ptr) { super(ptr); }
10 protected void finalize() throws Throwable {
11 if (ptr != 0) { bindings.CResult_PaymentSecretAPIErrorZ_free(ptr); } super.finalize();
14 static Result_PaymentSecretAPIErrorZ constr_from_ptr(long ptr) {
15 if (bindings.LDKCResult_PaymentSecretAPIErrorZ_result_ok(ptr)) {
16 return new Result_PaymentSecretAPIErrorZ_OK(null, ptr);
18 return new Result_PaymentSecretAPIErrorZ_Err(null, ptr);
21 public static final class Result_PaymentSecretAPIErrorZ_OK extends Result_PaymentSecretAPIErrorZ {
22 public final byte[] res;
23 private Result_PaymentSecretAPIErrorZ_OK(Object _dummy, long ptr) {
25 this.res = bindings.LDKCResult_PaymentSecretAPIErrorZ_get_ok(ptr);
29 public static final class Result_PaymentSecretAPIErrorZ_Err extends Result_PaymentSecretAPIErrorZ {
30 public final APIError err;
31 private Result_PaymentSecretAPIErrorZ_Err(Object _dummy, long ptr) {
33 long err = bindings.LDKCResult_PaymentSecretAPIErrorZ_get_err(ptr);
34 APIError err_hu_conv = APIError.constr_from_ptr(err);
35 err_hu_conv.ptrs_to.add(this);
36 this.err = err_hu_conv;
41 * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
43 public static Result_PaymentSecretAPIErrorZ ok(byte[] o) {
44 long ret = bindings.CResult_PaymentSecretAPIErrorZ_ok(o);
45 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
50 * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
52 public static Result_PaymentSecretAPIErrorZ err(APIError e) {
53 long ret = bindings.CResult_PaymentSecretAPIErrorZ_err(e.ptr);
54 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
59 * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
60 * but with all dynamically-allocated buffers duplicated in new buffers.
62 public Result_PaymentSecretAPIErrorZ clone() {
63 long ret = bindings.CResult_PaymentSecretAPIErrorZ_clone(this.ptr);
64 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);