Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Result_TxCreationKeysErrorZ.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9 public class Result_TxCreationKeysErrorZ extends CommonBase {
10         private Result_TxCreationKeysErrorZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_TxCreationKeysErrorZ_free(ptr); } super.finalize();
13         }
14
15         static Result_TxCreationKeysErrorZ constr_from_ptr(long ptr) {
16                 if (bindings.CResult_TxCreationKeysErrorZ_is_ok(ptr)) {
17                         return new Result_TxCreationKeysErrorZ_OK(null, ptr);
18                 } else {
19                         return new Result_TxCreationKeysErrorZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_TxCreationKeysErrorZ_OK extends Result_TxCreationKeysErrorZ {
23                 public final TxCreationKeys res;
24                 private Result_TxCreationKeysErrorZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         long res = bindings.LDKCResult_TxCreationKeysErrorZ_get_ok(ptr);
27                         TxCreationKeys res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new TxCreationKeys(null, res); }
28                         res_hu_conv.ptrs_to.add(this);
29                         this.res = res_hu_conv;
30                 }
31         }
32
33         public static final class Result_TxCreationKeysErrorZ_Err extends Result_TxCreationKeysErrorZ {
34                 public final Secp256k1Error err;
35                 private Result_TxCreationKeysErrorZ_Err(Object _dummy, long ptr) {
36                         super(_dummy, ptr);
37                         this.err = bindings.LDKCResult_TxCreationKeysErrorZ_get_err(ptr);
38                 }
39         }
40
41         /**
42          * Creates a new CResult_TxCreationKeysErrorZ in the success state.
43          */
44         public static Result_TxCreationKeysErrorZ ok(TxCreationKeys o) {
45                 long ret = bindings.CResult_TxCreationKeysErrorZ_ok(o == null ? 0 : o.ptr & ~1);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret);
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Creates a new CResult_TxCreationKeysErrorZ in the error state.
53          */
54         public static Result_TxCreationKeysErrorZ err(org.ldk.enums.Secp256k1Error e) {
55                 long ret = bindings.CResult_TxCreationKeysErrorZ_err(e);
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret);
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Checks if the given object is currently in the success state
63          */
64         public boolean is_ok() {
65                 boolean ret = bindings.CResult_TxCreationKeysErrorZ_is_ok(this.ptr);
66                 return ret;
67         }
68
69         long clone_ptr() {
70                 long ret = bindings.CResult_TxCreationKeysErrorZ_clone_ptr(this.ptr);
71                 return ret;
72         }
73
74         /**
75          * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
76          * but with all dynamically-allocated buffers duplicated in new buffers.
77          */
78         public Result_TxCreationKeysErrorZ clone() {
79                 long ret = bindings.CResult_TxCreationKeysErrorZ_clone(this.ptr);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret);
82                 return ret_hu_conv;
83         }
84
85 }