[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ProbeSendFailure.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  * Indicates that we failed to send a payment probe. Further errors may be surfaced later via
10  * [`Event::ProbeFailed`].
11  * 
12  * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed
13  */
14 public class ProbeSendFailure : CommonBase {
15         protected ProbeSendFailure(object _dummy, long ptr) : base(ptr) { }
16         ~ProbeSendFailure() {
17                 if (ptr != 0) { bindings.ProbeSendFailure_free(ptr); }
18         }
19
20         internal static ProbeSendFailure constr_from_ptr(long ptr) {
21                 long raw_ty = bindings.LDKProbeSendFailure_ty_from_ptr(ptr);
22                 switch (raw_ty) {
23                         case 0: return new ProbeSendFailure_RouteNotFound(ptr);
24                         case 1: return new ProbeSendFailure_SendingFailed(ptr);
25                         default:
26                                 throw new ArgumentException("Impossible enum variant");
27                 }
28         }
29
30         /** A ProbeSendFailure of type RouteNotFound */
31         public class ProbeSendFailure_RouteNotFound : ProbeSendFailure {
32                 internal ProbeSendFailure_RouteNotFound(long ptr) : base(null, ptr) {
33                 }
34         }
35         /** A ProbeSendFailure of type SendingFailed */
36         public class ProbeSendFailure_SendingFailed : ProbeSendFailure {
37                 public PaymentSendFailure sending_failed;
38                 internal ProbeSendFailure_SendingFailed(long ptr) : base(null, ptr) {
39                         long sending_failed = bindings.LDKProbeSendFailure_SendingFailed_get_sending_failed(ptr);
40                         org.ldk.structs.PaymentSendFailure sending_failed_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(sending_failed);
41                         if (sending_failed_hu_conv != null) { sending_failed_hu_conv.ptrs_to.AddLast(this); };
42                         this.sending_failed = sending_failed_hu_conv;
43                 }
44         }
45         internal long clone_ptr() {
46                 long ret = bindings.ProbeSendFailure_clone_ptr(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * Creates a copy of the ProbeSendFailure
53          */
54         public ProbeSendFailure clone() {
55                 long ret = bindings.ProbeSendFailure_clone(this.ptr);
56                 GC.KeepAlive(this);
57                 if (ret >= 0 && ret <= 4096) { return null; }
58                 org.ldk.structs.ProbeSendFailure ret_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(ret);
59                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
60                 return ret_hu_conv;
61         }
62
63         /**
64          * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure
65          */
66         public static ProbeSendFailure route_not_found() {
67                 long ret = bindings.ProbeSendFailure_route_not_found();
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 org.ldk.structs.ProbeSendFailure ret_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(ret);
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
71                 return ret_hu_conv;
72         }
73
74         /**
75          * Utility method to constructs a new SendingFailed-variant ProbeSendFailure
76          */
77         public static ProbeSendFailure sending_failed(org.ldk.structs.PaymentSendFailure a) {
78                 long ret = bindings.ProbeSendFailure_sending_failed(a.ptr);
79                 GC.KeepAlive(a);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 org.ldk.structs.ProbeSendFailure ret_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(ret);
82                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
83                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
84                 return ret_hu_conv;
85         }
86
87         /**
88          * Checks if two ProbeSendFailures contain equal inner contents.
89          * This ignores pointers and is_owned flags and looks at the values in fields.
90          */
91         public bool eq(org.ldk.structs.ProbeSendFailure b) {
92                 bool ret = bindings.ProbeSendFailure_eq(this.ptr, b == null ? 0 : b.ptr);
93                 GC.KeepAlive(this);
94                 GC.KeepAlive(b);
95                 return ret;
96         }
97
98         public override bool Equals(object o) {
99                 if (!(o is ProbeSendFailure)) return false;
100                 return this.eq((ProbeSendFailure)o);
101         }
102 }
103 } } }