Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Result_SignDecodeErrorZ.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_SignDecodeErrorZ extends CommonBase {
10         private Result_SignDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_SignDecodeErrorZ_free(ptr); } super.finalize();
13         }
14
15         static Result_SignDecodeErrorZ constr_from_ptr(long ptr) {
16                 if (bindings.CResult_SignDecodeErrorZ_is_ok(ptr)) {
17                         return new Result_SignDecodeErrorZ_OK(null, ptr);
18                 } else {
19                         return new Result_SignDecodeErrorZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_SignDecodeErrorZ_OK extends Result_SignDecodeErrorZ {
23                 public final Sign res;
24                 private Result_SignDecodeErrorZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         long res = bindings.LDKCResult_SignDecodeErrorZ_get_ok(ptr);
27                         Sign ret_hu_conv = new Sign(null, res);
28                         ret_hu_conv.ptrs_to.add(this);
29                         this.res = ret_hu_conv;
30                 }
31         }
32
33         public static final class Result_SignDecodeErrorZ_Err extends Result_SignDecodeErrorZ {
34                 public final DecodeError err;
35                 private Result_SignDecodeErrorZ_Err(Object _dummy, long ptr) {
36                         super(_dummy, ptr);
37                         long err = bindings.LDKCResult_SignDecodeErrorZ_get_err(ptr);
38                         DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); }
39                         err_hu_conv.ptrs_to.add(this);
40                         this.err = err_hu_conv;
41                 }
42         }
43
44         /**
45          * Creates a new CResult_SignDecodeErrorZ in the success state.
46          */
47         public static Result_SignDecodeErrorZ ok(Sign o) {
48                 long ret = bindings.CResult_SignDecodeErrorZ_ok(o == null ? 0 : o.ptr);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret);
51                 ret_hu_conv.ptrs_to.add(o);
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Creates a new CResult_SignDecodeErrorZ in the error state.
57          */
58         public static Result_SignDecodeErrorZ err(DecodeError e) {
59                 long ret = bindings.CResult_SignDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Checks if the given object is currently in the success state
67          */
68         public boolean is_ok() {
69                 boolean ret = bindings.CResult_SignDecodeErrorZ_is_ok(this.ptr);
70                 return ret;
71         }
72
73         long clone_ptr() {
74                 long ret = bindings.CResult_SignDecodeErrorZ_clone_ptr(this.ptr);
75                 return ret;
76         }
77
78         /**
79          * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
80          * but with all dynamically-allocated buffers duplicated in new buffers.
81          */
82         public Result_SignDecodeErrorZ clone() {
83                 long ret = bindings.CResult_SignDecodeErrorZ_clone(this.ptr);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret);
86                 return ret_hu_conv;
87         }
88
89 }