[C#] Drop reference to `assert` which makes building on Win hard
[ldk-java] / c_sharp / src / org / ldk / structs / Result_PayeePubKeyErrorZ.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 public class Result_PayeePubKeyErrorZ : CommonBase {
9         Result_PayeePubKeyErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_PayeePubKeyErrorZ() {
11                 if (ptr != 0) { bindings.CResult_PayeePubKeyErrorZ_free(ptr); }
12         }
13
14         internal static Result_PayeePubKeyErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_PayeePubKeyErrorZ_is_ok(ptr)) {
16                         return new Result_PayeePubKeyErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result_PayeePubKeyErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result_PayeePubKeyErrorZ_OK : Result_PayeePubKeyErrorZ {
22                 public readonly PayeePubKey res;
23                 internal Result_PayeePubKeyErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         long res = bindings.CResult_PayeePubKeyErrorZ_get_ok(ptr);
25                         org.ldk.structs.PayeePubKey res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.PayeePubKey(null, res); }
26                         if (res_hu_conv != null) { res_hu_conv.ptrs_to.AddLast(this); };
27                         this.res = res_hu_conv;
28                 }
29         }
30
31         public class Result_PayeePubKeyErrorZ_Err : Result_PayeePubKeyErrorZ {
32                 public readonly Secp256k1Error err;
33                 internal Result_PayeePubKeyErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
34                         this.err = bindings.CResult_PayeePubKeyErrorZ_get_err(ptr);
35                 }
36         }
37
38         /**
39          * Creates a new CResult_PayeePubKeyErrorZ in the success state.
40          */
41         public static Result_PayeePubKeyErrorZ ok(org.ldk.structs.PayeePubKey o) {
42                 long ret = bindings.CResult_PayeePubKeyErrorZ_ok(o == null ? 0 : o.ptr);
43                 GC.KeepAlive(o);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.constr_from_ptr(ret);
46                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o); };
47                 return ret_hu_conv;
48         }
49
50         /**
51          * Creates a new CResult_PayeePubKeyErrorZ in the error state.
52          */
53         public static Result_PayeePubKeyErrorZ err(Secp256k1Error e) {
54                 long ret = bindings.CResult_PayeePubKeyErrorZ_err(e);
55                 GC.KeepAlive(e);
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.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 bool is_ok() {
65                 bool ret = bindings.CResult_PayeePubKeyErrorZ_is_ok(this.ptr);
66                 GC.KeepAlive(this);
67                 return ret;
68         }
69
70         internal long clone_ptr() {
71                 long ret = bindings.CResult_PayeePubKeyErrorZ_clone_ptr(this.ptr);
72                 GC.KeepAlive(this);
73                 return ret;
74         }
75
76         /**
77          * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
78          * but with all dynamically-allocated buffers duplicated in new buffers.
79          */
80         public Result_PayeePubKeyErrorZ clone() {
81                 long ret = bindings.CResult_PayeePubKeyErrorZ_clone(this.ptr);
82                 GC.KeepAlive(this);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.constr_from_ptr(ret);
85                 return ret_hu_conv;
86         }
87
88 }
89 } } }