[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / SignOrCreationError.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`]
10  * may occur.
11  */
12 public class SignOrCreationError : CommonBase {
13         protected SignOrCreationError(object _dummy, long ptr) : base(ptr) { }
14         ~SignOrCreationError() {
15                 if (ptr != 0) { bindings.SignOrCreationError_free(ptr); }
16         }
17
18         internal static SignOrCreationError constr_from_ptr(long ptr) {
19                 long raw_ty = bindings.LDKSignOrCreationError_ty_from_ptr(ptr);
20                 switch (raw_ty) {
21                         case 0: return new SignOrCreationError_SignError(ptr);
22                         case 1: return new SignOrCreationError_CreationError(ptr);
23                         default:
24                                 throw new ArgumentException("Impossible enum variant");
25                 }
26         }
27
28         /** A SignOrCreationError of type SignError */
29         public class SignOrCreationError_SignError : SignOrCreationError {
30                 internal SignOrCreationError_SignError(long ptr) : base(null, ptr) {
31                 }
32         }
33         /** A SignOrCreationError of type CreationError */
34         public class SignOrCreationError_CreationError : SignOrCreationError {
35                 public CreationError creation_error;
36                 internal SignOrCreationError_CreationError(long ptr) : base(null, ptr) {
37                         this.creation_error = bindings.LDKSignOrCreationError_CreationError_get_creation_error(ptr);
38                 }
39         }
40         internal long clone_ptr() {
41                 long ret = bindings.SignOrCreationError_clone_ptr(this.ptr);
42                 GC.KeepAlive(this);
43                 return ret;
44         }
45
46         /**
47          * Creates a copy of the SignOrCreationError
48          */
49         public SignOrCreationError clone() {
50                 long ret = bindings.SignOrCreationError_clone(this.ptr);
51                 GC.KeepAlive(this);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret);
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
55                 return ret_hu_conv;
56         }
57
58         /**
59          * Utility method to constructs a new SignError-variant SignOrCreationError
60          */
61         public static SignOrCreationError sign_error() {
62                 long ret = bindings.SignOrCreationError_sign_error();
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret);
65                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Utility method to constructs a new CreationError-variant SignOrCreationError
71          */
72         public static SignOrCreationError creation_error(CreationError a) {
73                 long ret = bindings.SignOrCreationError_creation_error(a);
74                 GC.KeepAlive(a);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret);
77                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
78                 return ret_hu_conv;
79         }
80
81         /**
82          * Checks if two SignOrCreationErrors contain equal inner contents.
83          * This ignores pointers and is_owned flags and looks at the values in fields.
84          */
85         public bool eq(org.ldk.structs.SignOrCreationError b) {
86                 bool ret = bindings.SignOrCreationError_eq(this.ptr, b == null ? 0 : b.ptr);
87                 GC.KeepAlive(this);
88                 GC.KeepAlive(b);
89                 return ret;
90         }
91
92         public override bool Equals(object o) {
93                 if (!(o is SignOrCreationError)) return false;
94                 return this.eq((SignOrCreationError)o);
95         }
96         /**
97          * Get the string representation of a SignOrCreationError object
98          */
99         public string to_str() {
100                 long ret = bindings.SignOrCreationError_to_str(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 string ret_conv = InternalUtils.decodeString(ret);
104                 return ret_conv;
105         }
106
107 }
108 } } }