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