6 namespace org { namespace ldk { namespace structs {
9 * An error that may occur when sending a payment probe.
11 public class ProbingError : CommonBase {
12 protected ProbingError(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.ProbingError_free(ptr); }
17 internal static ProbingError constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKProbingError_ty_from_ptr(ptr);
20 case 0: return new ProbingError_Invoice(ptr);
21 case 1: return new ProbingError_Sending(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A ProbingError of type Invoice */
28 public class ProbingError_Invoice : ProbingError {
29 public string invoice;
30 internal ProbingError_Invoice(long ptr) : base(null, ptr) {
31 long invoice = bindings.LDKProbingError_Invoice_get_invoice(ptr);
32 string invoice_conv = InternalUtils.decodeString(invoice);
33 this.invoice = invoice_conv;
36 /** A ProbingError of type Sending */
37 public class ProbingError_Sending : ProbingError {
38 public ProbeSendFailure sending;
39 internal ProbingError_Sending(long ptr) : base(null, ptr) {
40 long sending = bindings.LDKProbingError_Sending_get_sending(ptr);
41 org.ldk.structs.ProbeSendFailure sending_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(sending);
42 if (sending_hu_conv != null) { sending_hu_conv.ptrs_to.AddLast(this); };
43 this.sending = sending_hu_conv;
46 internal long clone_ptr() {
47 long ret = bindings.ProbingError_clone_ptr(this.ptr);
53 * Creates a copy of the ProbingError
55 public ProbingError clone() {
56 long ret = bindings.ProbingError_clone(this.ptr);
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.ProbingError ret_hu_conv = org.ldk.structs.ProbingError.constr_from_ptr(ret);
60 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
65 * Utility method to constructs a new Invoice-variant ProbingError
67 public static ProbingError invoice(string a) {
68 long ret = bindings.ProbingError_invoice(InternalUtils.encodeString(a));
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.ProbingError ret_hu_conv = org.ldk.structs.ProbingError.constr_from_ptr(ret);
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
77 * Utility method to constructs a new Sending-variant ProbingError
79 public static ProbingError sending(org.ldk.structs.ProbeSendFailure a) {
80 long ret = bindings.ProbingError_sending(a.ptr);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.ProbingError ret_hu_conv = org.ldk.structs.ProbingError.constr_from_ptr(ret);
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
90 * Checks if two ProbingErrors contain equal inner contents.
91 * This ignores pointers and is_owned flags and looks at the values in fields.
93 public bool eq(org.ldk.structs.ProbingError b) {
94 bool ret = bindings.ProbingError_eq(this.ptr, b == null ? 0 : b.ptr);
100 public override bool Equals(object o) {
101 if (!(o is ProbingError)) return false;
102 return this.eq((ProbingError)o);